diff options
author | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2019-03-23 15:10:58 +0300 |
---|---|---|
committer | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2019-03-23 15:10:58 +0300 |
commit | e8fb49be5f33ad61ac4c8a358b327b88014f3494 (patch) | |
tree | c8c4996b1360f03165d3c03cb8fdc886c43ae305 /library.c | |
parent | 603ba48d58409b4bb4f8012b3eceb4596e064945 (diff) |
Issue #1523
Add server address to exception message.
Diffstat (limited to 'library.c')
-rw-r--r-- | library.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -2295,11 +2295,19 @@ redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size, if(php_stream_get_line(redis_sock->stream, buf, buf_size, line_size) == NULL) { + char *errmsg = NULL; + + if (redis_sock->port < 0) { + spprintf(&errmsg, 0, "read error on connection to %S", redis_sock->host); + } else { + spprintf(&errmsg, 0, "read error on connection to %S:%d", redis_sock->host, redis_sock->port); + } // Close our socket redis_sock_disconnect(redis_sock, 1 TSRMLS_CC); // Throw a read error exception - REDIS_THROW_EXCEPTION( "read error on connection", 0); + REDIS_THROW_EXCEPTION(errmsg, 0); + efree(errmsg); return -1; } |