Skip to content

Commit 4e84430

Browse files
committed
process the result outside of the rescue block so we can raise our own exceptions properly
1 parent 9221478 commit 4e84430

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/mysql2/client.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ static VALUE disconnect_and_raise(VALUE self, VALUE error) {
326326
shutdown(wrapper->client->net.fd, 2);
327327

328328
rb_exc_raise(error);
329+
329330
return Qnil;
330331
}
331332
#endif
@@ -380,7 +381,7 @@ static VALUE do_query(void *args) {
380381
}
381382
}
382383

383-
return rb_mysql_client_async_result(async_args->self);
384+
return Qnil;
384385
}
385386

386387
static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) {
@@ -434,7 +435,9 @@ static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) {
434435
async_args.fd = wrapper->client->net.fd;
435436
async_args.self = self;
436437

437-
return rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0);
438+
rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0);
439+
440+
return rb_mysql_client_async_result(self);
438441
} else {
439442
return Qnil;
440443
}

0 commit comments

Comments
 (0)