mirror of https://github.com/reiseburo/hermann
Properly raise an exception when the consumer is given an empty topic
This commit is contained in:
parent
655cc4463a
commit
0eb18479b6
|
@ -378,9 +378,11 @@ static VALUE consumer_consume(VALUE self) {
|
|||
|
||||
Data_Get_Struct(self, HermannInstanceConfig, consumerConfig);
|
||||
|
||||
if (consumerConfig->topic==NULL) {
|
||||
fprintf(stderr, "Topic is null!");
|
||||
return;
|
||||
if ((NULL == consumerConfig->topic) ||
|
||||
(0 == strlen(consumerConfig->topic))) {
|
||||
fprintf(stderr, "Topic is null!\n");
|
||||
rb_raise(rb_eRuntimeError, "Topic cannot be empty");
|
||||
return self;
|
||||
}
|
||||
|
||||
if (!consumerConfig->isInitialized) {
|
||||
|
|
|
@ -26,5 +26,10 @@ describe Hermann::Consumer do
|
|||
let(:brokers) { '' }
|
||||
it_behaves_like 'an error condition'
|
||||
end
|
||||
|
||||
context 'with a bad topic' do
|
||||
let(:topic) { '' }
|
||||
it_behaves_like 'an error condition'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue