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

fix(gotrue): Handle empty error response #1143

Merged
merged 2 commits into from
Apr 7, 2025
Merged

Conversation

Vinzent03
Copy link
Collaborator

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

When receiving an error response, which doesn't contain any body, the decoding to json throws a FormatException. This is very misleading, because we shouldn't try to decode an empty response. This happened to me while doing some testing, but I do not exactly remember the reason for the error anymore.

What is the new behavior?

Do not decode an empty response.

In addition, I added a toString for every subclass of AuthException.

Additional context

@coveralls
Copy link

coveralls commented Mar 31, 2025

Pull Request Test Coverage Report for Build 14179551608

Details

  • 17 of 27 (62.96%) changed or added relevant lines in 4 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.2%) to 75.252%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/gotrue/lib/src/types/auth_exception.dart 4 14 28.57%
Files with Coverage Reduction New Missed Lines %
packages/gotrue/lib/src/gotrue_client.dart 1 64.99%
packages/gotrue/lib/src/fetch.dart 2 92.59%
Totals Coverage Status
Change from base Build 14080727348: -0.2%
Covered Lines: 2840
Relevant Lines: 3774

💛 - Coveralls

@Vinzent03 Vinzent03 changed the title fix(gotrue): handle empty error response fix(gotrue): Handle empty error response Mar 31, 2025
@Vinzent03 Vinzent03 requested a review from dshukertjr March 31, 2025 19:17
Copy link
Member

@dshukertjr dshukertjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for this!

@Vinzent03 Vinzent03 merged commit 591bb82 into main Apr 7, 2025
11 of 12 checks passed
@Vinzent03 Vinzent03 deleted the fix/empty-response branch April 7, 2025 19:24
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.

4 participants