diff options
author | Pavlo Yatsukhnenko <yatsukhnenko@users.noreply.github.com> | 2019-05-12 23:15:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-12 23:15:10 +0300 |
commit | 34c8c68873dd2fd5c7e3f5bcf7367d31da78ae34 (patch) | |
tree | c2cad51fd1c7753fcf5597eb192f610dbb972eeb /library.c | |
parent | 95efd2140ad7d8e6cbee73efcf98338651673ee6 (diff) | |
parent | e8fb49be5f33ad61ac4c8a358b327b88014f3494 (diff) |
Merge pull request #1531 from phpredis/issue.1523
Issue #1523
Let's merge it and see users reaction 🤣
Diffstat (limited to 'library.c')
-rw-r--r-- | library.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -2340,11 +2340,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; } |