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

feat: 500+ error handling #9

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

tom-laplace
Copy link
Contributor

πŸ”— Linked issue

Issue : #3

It's not an open issue but as I was reading the comments you seems interested in this changes.

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Resolves : #3

Context

Currently, requests that receive 500+ status codes throw an error instead of returning an ApiResponse object.
This makes it difficult to test and handle server errors in a consistent way.

Changes

  • Modified error handling to treat 500+ errors like other HTTP errors
  • All HTTP errors now return an ApiResponse object
  • Added tests for server error handling

Benefits

  • Consistent error handling across all HTTP status codes
  • Easier testing of server error scenarios

Breaking Changes

  • Requests that receive 500+ status codes no longer throw errors
  • Code that was catching 500+ errors will need to check response.hasFatalError() instead

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

I am ready to open a PR on the doc if this one is merged.
It's my first "real"' open-source PR, feel free to point out any mistakes or improvements I can make to it πŸ˜„

@thetutlage thetutlage merged commit 014fbca into japa:develop Dec 18, 2024
6 checks passed
@thetutlage
Copy link
Contributor

Thanks πŸ‘

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.

Request throwing error when status code is 500
2 participants