Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add code to error object if ErrorDetail has code #700

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

Merged
sliverc merged 2 commits into django-json-api:master from novastone-media:error_code
Sep 11, 2019

Conversation

Copy link
Contributor

@josebama josebama commented Sep 10, 2019
edited
Loading

Description of the Change

JSON:API specification allows for a code value in the error object. This PR copies the code inside the ErrorDetail from rest_framework's APIException into the JSON:API error object. Allowing users of the library to send application-specific error codes back to the clients by specifying a code alongside the detail when raising an APIException

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

Copy link

codecov bot commented Sep 11, 2019
edited
Loading

Codecov Report

Merging #700 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@
## master #700 +/- ##
=======================================
 Coverage 95.97% 95.97% 
=======================================
 Files 54 54 
 Lines 2735 2735 
=======================================
 Hits 2625 2625 
 Misses 110 110
Impacted Files Coverage Δ
example/tests/test_generic_validation.py 100% <ø> (ø) ⬆️
example/tests/test_generic_viewset.py 100% <ø> (ø) ⬆️
example/tests/test_model_viewsets.py 100% <ø> (ø) ⬆️
example/tests/test_views.py 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 252d164...d2c8e47. Read the comment docs.

1 similar comment
Copy link

codecov bot commented Sep 11, 2019

Codecov Report

Merging #700 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@
## master #700 +/- ##
=======================================
 Coverage 95.97% 95.97% 
=======================================
 Files 54 54 
 Lines 2735 2735 
=======================================
 Hits 2625 2625 
 Misses 110 110
Impacted Files Coverage Δ
example/tests/test_generic_validation.py 100% <ø> (ø) ⬆️
example/tests/test_generic_viewset.py 100% <ø> (ø) ⬆️
example/tests/test_model_viewsets.py 100% <ø> (ø) ⬆️
example/tests/test_views.py 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 252d164...d2c8e47. Read the comment docs.

Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

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

Nice work and a great improvement! Thanks.

@sliverc sliverc merged commit 44b1f68 into django-json-api:master Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@sliverc sliverc sliverc approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /