You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when this error occurs when attempting to consume from a non-existent topic, it's incredibly difficult to figure out what topic is causing the actual issue (especially if you consume a lot of different topics):
UnhandledPromiseRejectionWarning: KafkaJSProtocolError: This server does not host this topic-partition
``
I'd be much easier to debug these exceptions if they instead provided more context:
UnhandledPromiseRejectionWarning: KafkaJSProtocolError: This server does not host this topic-partition: namespace.v1.Topic
That change alone could have saved my team hours of debugging. We expected one topic to be the culprit and it in fact was another.
**Additional context**
I've looked in [errors.js](https://github.com/tulios/kafkajs/blob/9b5ef7f7961fdb6716e2e90634b36abb81d24af9/src/errors.js#L22-L29) and it seems like it would possible to add `topic = null` as an option in the second argument object and then do something like:
```javascript
class KafkaJSProtocolError extends KafkaJSError {
constructor(e, { retriable = e.retriable, topic = null } = {}) {
super(e, { retriable })
this.message = e.message
(topic !== null) ? this.message += (": " + topic)
this.type = e.type
this.code = e.code
this.name = 'KafkaJSProtocolError'
}
}
This is a quick POC and I don't really know where the topic could be sent a KafkaJSProtocolError instance but I'd gladly take some guidance and open a PR if that seems reasonable.
The text was updated successfully, but these errors were encountered:
Currently when this error occurs when attempting to consume from a non-existent topic, it's incredibly difficult to figure out what topic is causing the actual issue (especially if you consume a lot of different topics):
UnhandledPromiseRejectionWarning: KafkaJSProtocolError: This server does not host this topic-partition: namespace.v1.Topic
This is a quick POC and I don't really know where the topic could be sent a
KafkaJSProtocolError
instance but I'd gladly take some guidance and open a PR if that seems reasonable.The text was updated successfully, but these errors were encountered: