Skip to content

Conversation

josebama
Copy link
Contributor

@josebama josebama commented Sep 10, 2019

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

@codecov
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.

1 similar comment
@codecov
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants