-
Notifications
You must be signed in to change notification settings - Fork 336
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
Expose Error for user #1142
Comments
Thanks for reporting this case @WoWsj! I agree that currently almost all errors pulsar-client-go returns are opaque and we may expose the error in the public API or define some common categories (is_fatal? is_retriable?). Can you share a bit more details what methods you want to handle its errors and what errors you want handle specifically? Besides, I remember that @flowchartsman ever had a similar idea to expose client errors API in #1075. May you can share the design thoughts here to find a consensus. Also cc @RobertIndie @gunli @Gleiphir2769 @wolfstudy @nodece |
+1. I think at least it should allow users to use the std library to compare errors (errors.Is/As). |
Thanks for reporting it. I'm +1 for this. Just to make sure we need to handle the backward compatibility carefully. |
A rough approach is sorting out all the errors we return now and move them to a public package ( Still, user cases that need to handle concrete errors specially help us formalize the API. |
I have searched all errors pulsar-client-go returned with key words
I think it's too difficult to sorting out ALL errors. The better way is to sort out errors relative producer/consumer public API. What do you think? @tisonkun |
Thank you for your report, when you want to check if the error comes from the server or client, it isn't easy, and the error has been wrapped by
This is a good direction, and we can define a const error instead of the current implementation, and wrapping the original error by For the library, we need to be compatible with lower versions of Go, so we need to consider introducing an error-wrap library instead The following are known error-wrap libraries: |
I am trying to use However, when I checked the code,
So, In my cases, I want:
|
I have checked these packages, "https://github.com/cockroachdb/errors" require go 1.19, "https://github.com/uber-go/multierr" require go 1.20, may be we can use "https://github.com/hashicorp/go-multierror" And, I have pushed a PR relative to this iusse #1143. |
Can we now expose errors, and let users be able to use error? |
Is your feature request related to a problem? Please describe.
Hello, I'm currently trying to use pulser-client-go, and it seems very useful and easy.
However, producer can occur error and it is really ok. But, in some cases, I want to do some specific behavior based on its error content.
But, this package doesn't expose Error's field and doesn't offer any method or easy way to compare errors. So, I need to rewrite errors and write some comparing logic for my business logic.
I think it is not good pattern. If it is ok, please expose errors.
Describe the solution you'd like
Expose errors, and let users be able to use error.
The text was updated successfully, but these errors were encountered: