From 3a6c02f02337d9094617f020db2fcd3af6bf075e Mon Sep 17 00:00:00 2001 From: Stan Campbell Date: Fri, 5 Sep 2014 10:07:43 -0700 Subject: [PATCH] Remove exit(..) calls and replace by raising a runtime exception to Ruby. --- ext/hermann/hermann_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/hermann/hermann_lib.c b/ext/hermann/hermann_lib.c index 200c6a0..e84b4a5 100644 --- a/ext/hermann/hermann_lib.c +++ b/ext/hermann/hermann_lib.c @@ -308,7 +308,7 @@ void consumer_init_kafka(HermannInstanceConfig* config) { if (!(config->rk = rd_kafka_new(RD_KAFKA_CONSUMER, config->conf, config->errstr, sizeof(config->errstr)))) { fprintf(stderr, "%% Failed to create new consumer: %s\n", config->errstr); - exit(1); + rb_raise(rb_eRuntimeError, "%% Failed to create new consumer: %s\n", config->errstr); } /* Set logger */ @@ -470,7 +470,7 @@ void producer_init_kafka(HermannInstanceConfig* config) { if (!(config->rk = rd_kafka_new(RD_KAFKA_PRODUCER, config->conf, config->errstr, sizeof(config->errstr)))) { fprintf(stderr, "%% Failed to create new producer: %s\n", config->errstr); - exit(1); + rb_raise(rb_eRuntimeError, "%% Failed to create new producer: %s\n", config->errstr); } /* Set logger */