Skip to content
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

Add Error.Is interface method on the custom error type APIError. #162

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

oldztimer
Copy link
Contributor

This method supports doing "errors.Is" checks so downstream can handle API errors more specifically.

In my case, since I copied your lazyClient example, but I'm using it in a server, the Login needs to be refreshed if an API call errors out with "api.err.LoginRequired". There was no clean way to check for this specific error in order to refresh the login and retry.

This method supports doing "errors.Is" checks so downstream can handle API errors more specifically.

In my case, since I copied your lazyClient example, but I'm using it in a server, the Login needs to be refreshed if an API call errors out with "api.err.LoginRequired".
There was no clean way to check for this specific error in order to refresh the login and retry.
@oldztimer
Copy link
Contributor Author

@paultyng Hoping you'd be interested in the PR to support clients processing API errors.

@filipowm
Copy link
Contributor

filipowm commented Jan 2, 2025

@joshuaspence This one seems to be ok for merging. What do you think?

@joshuaspence joshuaspence merged commit df68605 into paultyng:main Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants