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. mapping Optimized error stack #4178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

reatang
Copy link
Contributor

@reatang reatang commented Jun 4, 2024

Optimize error returns to allow external parties to better judge errors

I can set an error handler to accurately handle error parameters with a single judgment.

httpx.SetErrorHandler(func(err error) (int, any) {
      if errors.Is(err, mapping.ErrMappingErrors) {
	      return http.StatusBadRequest, nil
      }
      
      return http.StatusInternalServerError, nil
})

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

Attention: Patch coverage is 85.52632% with 11 lines in your changes missing coverage. Please review.

Project coverage is 95.10%. Comparing base (8690859) to head (bb60a0a).
Report is 58 commits behind head on master.

Additional details and impacted files
Files Coverage Δ
core/mapping/fieldoptions.go 100.00% <100.00%> (ø)
core/mapping/marshaler.go 100.00% <100.00%> (ø)
core/mapping/utils.go 100.00% <100.00%> (ø)
core/mapping/unmarshaler.go 96.33% <73.17%> (-0.15%) ⬇️

... and 251 files with indirect coverage changes

@reatang reatang changed the title mapping Optimized error stack feat. mapping Optimized error stack Jun 11, 2024
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.

None yet

1 participant