Closed sharathbaddam closed 6 years ago
Kafka errors (like wrong/failed partition, etc) are returned in .then
as a grand total result of publishing many messages to different topic/partitions pairs (some may succeed while other may fail). Severe errors (such as network errors, etc) are returned as rejected promise and should be processed .catch
Thanks for quick response, i was looking at documentation and found that result returned in then() looks something like this :- [ { topic: 'kafka-test-topic', partition: 0, offset: 353 } ] . If there is any error, other property like "error":"" is added in the object ? or i get completely different response ?
The property error
is always there. It is set to null
when there is no error.
perfect!
But the typings file doesn't have error
,
https://github.com/oleksiyk/kafka/blob/master/types/producer.d.ts#L182
Can we have to update the result interface in typings file to something like below ?
{
topic: string;
partition: number;
offset: number;
error:NodeJS.ErrnoException
}
If i have any errors sending data to my kakfa broker using producer.send() where do i look for it ?
is it returned in .then(result) or in .catch(error) ?