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

FronteggError Enum Granularity #52

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

nickkhg
Copy link
Contributor

@nickkhg nickkhg commented Jul 22, 2024

Overview

This PR extracts all errors thrown by the SDK into strongly typed errors whilst keeping the same messaging as the current live version of the SDK.

This approach adds support for an additional level of granularity when it comes to handling errors on the client side.

Reasoning

The current implementation throws two types of errors (configError and authError), but the associated values of those enum cases are both Strings, which doesn't allow for disambiguation of the error message at the client level. Because of this, clients can only distinguish between configError and authError, so barring any exact string checks on the client side, it is not possible to display custom error messages for each situation.

An example of such scenario is presenting different error messages when the user cancels the authentication session versus a failed authentication error.

Another example is the localisation of the errors thrown into multiple languages on the client side.

The approach in this PR addresses both of these issues.

@frontegg-david frontegg-david merged commit 42043ca into frontegg:master Jul 23, 2024
@frontegg-david frontegg-david mentioned this pull request Jul 23, 2024
@nickkhg nickkhg deleted the feature/add-error-enums branch July 23, 2024 13:46
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.

2 participants