Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8fb49b

Browse files
committed
Issue #1523
Add server address to exception message.
1 parent 603ba48 commit e8fb49b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

library.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2295,11 +2295,19 @@ redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size,
22952295
if(php_stream_get_line(redis_sock->stream, buf, buf_size, line_size)
22962296
== NULL)
22972297
{
2298+
char *errmsg = NULL;
2299+
2300+
if (redis_sock->port < 0) {
2301+
spprintf(&errmsg, 0, "read error on connection to %S", redis_sock->host);
2302+
} else {
2303+
spprintf(&errmsg, 0, "read error on connection to %S:%d", redis_sock->host, redis_sock->port);
2304+
}
22982305
// Close our socket
22992306
redis_sock_disconnect(redis_sock, 1 TSRMLS_CC);
23002307

23012308
// Throw a read error exception
2302-
REDIS_THROW_EXCEPTION( "read error on connection", 0);
2309+
REDIS_THROW_EXCEPTION(errmsg, 0);
2310+
efree(errmsg);
23032311
return -1;
23042312
}
23052313

0 commit comments

Comments
 (0)