-
-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide additional metadata in errors #957
Comments
This is a good idea and something that can be done incrementally on a case-by-case basis. The way that protocol errors work is that whenever we receive a response from the API, there can be one or more error codes returned. For example, the response for CreateTopics v0 looks like this:
This can be read as an array of The error code can then be looked up in this list. So if we for example receive the number 29, that corresponds to TOPIC_AUTHORIZATION_FAILED. In most cases, this is handled generically using the Lines 580 to 582 in 28e5be5
kafkajs/src/protocol/requests/createTopics/v0/response.js Lines 25 to 32 in 28e5be5
In this case, we are simply checking all the |
@Nevon From what I gather from the issue it seems like that each of the protocol calls would need a separate wrapped error class (depending on the use case). |
I think it would have to be on a case-by-case basis. In some cases, it might be enough to create a class for a specific protocol error (this is already done in some cases) and throw that instead of a generic There's also looking into where these errors are caught. I suspect there are a few places where we are explicitly handling |
I'll give a initial try with wrapping class approach on the |
Next phase for restructure I am targeting (each point will be a separate PR)
After that probably I will be targeting the producer module |
The changes made in #1104 unfortunately don't include the actual error message from bubbling up when creating topic. I had to use the debugger to stop execution and inspect the error message around this line: |
What is the status of this issue? The affecting topic is still not available in the KafkaJSProtocolError. Is there any userland solution to retrieve it? |
Is your feature request related to a problem? Please describe.
Currently, there are many errors that do not provide certain metadata. For example, TOPIC_AUTHORIZATION_FAILED does not provide the topic(s) that failed to authorize. We provide our producer with multiple brokers and use sendBatch to send to multiple topics. It appears that some messages go through to one broker but not another but a lot of research needs to be done to figure out the problematic topic(s). It would be nice if the error message provided more information for diagnosing issues.
Describe the solution you'd like
For error messages related to producing or consuming from topics it would be useful to have the topics that caused the error in the error.
The text was updated successfully, but these errors were encountered: