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

improve Typesense client exception semantics #70

Merged
merged 7 commits into from
Mar 27, 2022

Conversation

runeanielsen
Copy link
Member

Note

Breaking changes!

This update will result in breaking changes for clients that used null checks to see if a resource existed or not. The new implementation will throw an TypesenseApiNotFoundException instead, the benefit is that the API will be more uniform overall.

Change

Now provides a range of more specific exceptions. The reason is to improve error-handling. Instead of only having TypesenseApiException, the client now has a range of exception types all inheriting from TypesenseApiException, so if you're already catching TypesenseApiException, you won't have to change anything. The error types has been taken from Typesense documentation regarding API errors link.

Type Description
TypesenseApiException Base exception type for Typesense api exceptions.
TypesenseApiBadRequestException Bad Request - The request could not be understood due to malformed syntax.
TypesenseApiUnauthorizedException Unauthorized - Your API key is wrong.
TypesenseApiNotFoundException Not Found - The requested resource is not found.
TypesenseApiConflictException Conflict - When a resource already exists.
TypesenseApiUnprocessableEntityException Unprocessable Entity - Request is well-formed, but cannot be processed.
TypesenseApiServiceUnavailableException Service Unavailable - We’re temporarily offline. Please try again later.

@runeanielsen runeanielsen merged commit 35831e6 into DAXGRID:master Mar 27, 2022
@runeanielsen runeanielsen deleted the add-specialized-exceptions branch March 27, 2022 18:27
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.

1 participant