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

Migrate all errors to structs [SDK-2968] #552

Merged
merged 14 commits into from
Nov 29, 2021
Merged

Migrate all errors to structs [SDK-2968] #552

merged 14 commits into from
Nov 29, 2021

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented Nov 19, 2021

Changes

⚠️ THIS PR CONTAINS BREAKING CHANGES

In Auth0.swift 1.x WebAuthError and CredentialsManagerError are enums, and as such the consumers must switch exhaustively over all the cases. This means that adding new cases constitutes a breaking change. So this was the source of many TODO: comments, as new error cases needed to be added.

This PR migrates all errors to be structs, and in the case of WebAuthError and CredentialsManagerError in particular, all the former cases are now static properties, meaning that they can be switched over but that switch can never be exhaustive. So adding new error cases will not be a breaking change.

Additionally, the error handling DX was improved, as now all errors conform to Equatable and CustomDebugStringConvertible, and all errors are being properly wrapped. Before, Web Auth could produce either a WebAuthError or an AuthenticationError; now it will only produce a WebAuthError. Same for the Credentials Manager, which will only produce a CredentialsManagerError.

Testing

  • This change adds unit test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@Widcket Widcket changed the base branch from master to beta November 19, 2021 02:44
@Widcket Widcket marked this pull request as ready for review November 20, 2021 02:34
@Widcket Widcket requested a review from a team as a code owner November 20, 2021 02:34
@Widcket Widcket added the review:large Large review label Nov 20, 2021
V2_MIGRATION_GUIDE.md Outdated Show resolved Hide resolved
@Widcket Widcket merged commit 967000b into beta Nov 29, 2021
@Widcket Widcket deleted the v2/struct-errors branch November 29, 2021 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:large Large review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants