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

Handle undecodable responses gracefully #25

Merged
merged 3 commits into from
Jan 5, 2024
Merged

Handle undecodable responses gracefully #25

merged 3 commits into from
Jan 5, 2024

Conversation

jenky
Copy link
Collaborator

@jenky jenky commented Jan 5, 2024

Introduced a try-catch block in the data() method to catch NotDecodableException when attempting to decode response data. In such cases, decoding will now default to an empty array instead of throwing an unhandled exception. Moreover, clarified method return types in doc comments for onError, throw, and throwIf to reflect the generic Response<T> type.

jenky added 3 commits January 5, 2024 16:29
Introduced a try-catch block in the data() method to catch
`NotDecodableException` when attempting to decode response data. In such
cases, decoding will now default to an empty array instead of throwing
an unhandled exception. Moreover, clarified method return types in doc
comments for `onError`, `throw`, and `throwIf` to reflect the generic
`Response<T>` type.
Copy link

codecov bot commented Jan 5, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (fe40221) 85.39% compared to head (ad92820) 85.29%.

Files Patch % Lines
src/Response.php 50.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #25      +/-   ##
============================================
- Coverage     85.39%   85.29%   -0.10%     
- Complexity      326      327       +1     
============================================
  Files            39       39              
  Lines           753      755       +2     
============================================
+ Hits            643      644       +1     
- Misses          110      111       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jenky jenky merged commit c5e9ed0 into main Jan 5, 2024
7 of 9 checks passed
@jenky jenky deleted the refactor-response branch January 5, 2024 09: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.

1 participant