mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
fixup! exception_handler: add codes for Http404 and PermissionDenied
[ci skip]
This commit is contained in:
parent
c6dd9f8bfb
commit
1dae174ae4
|
@ -81,7 +81,7 @@ def exception_handler(exc, context):
|
|||
|
||||
elif isinstance(exc, Http404):
|
||||
msg = _('Not found.')
|
||||
data = {'detail': {'non_field_errors': [{
|
||||
data = {'detail': {api_settings.NON_FIELD_ERRORS_KEY: [{
|
||||
'message': six.text_type(msg),
|
||||
'code': 'not_found'}]}}
|
||||
|
||||
|
@ -90,7 +90,7 @@ def exception_handler(exc, context):
|
|||
|
||||
elif isinstance(exc, PermissionDenied):
|
||||
msg = _('Permission denied.')
|
||||
data = {'detail': {'non_field_errors': [{
|
||||
data = {'detail': {api_settings.NON_FIELD_ERRORS_KEY: [{
|
||||
'message': six.text_type(msg),
|
||||
'code': 'permission_denied'}]}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user