mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-01 21:36:25 -06:00
Fixes #7109: When handling an exception during an API query, send an error response containing structured information about the error rather than HTML
This commit is contained in:
parent
691c66d2f5
commit
93b9b6d01c
@ -23,6 +23,7 @@
|
||||
* [#7101](https://github.com/netbox-community/netbox/issues/7101) - Enforce `MAX_PAGE_SIZE` for table and REST API pagination
|
||||
* [#7106](https://github.com/netbox-community/netbox/issues/7106) - Fix incorrect "Map It" button URL on a site's Physical Address field
|
||||
* [#7107](https://github.com/netbox-community/netbox/issues/7107) - Fix missing search button and search results in IP Address assignment "Assign IP" tab
|
||||
* [#7109](https://github.com/netbox-community/netbox/issues/7109) - When handling an exception during an API query, send an error response containing structured information about the error rather than HTML.
|
||||
|
||||
---
|
||||
|
||||
|
@ -22,7 +22,7 @@ from extras.models import ExportTemplate
|
||||
from netbox.api import BulkOperationSerializer
|
||||
from netbox.api.authentication import IsAuthenticatedOrLoginNotRequired
|
||||
from netbox.api.exceptions import SerializerNotFound
|
||||
from utilities.api import get_serializer_for_model
|
||||
from utilities.api import get_serializer_for_model, rest_api_server_error
|
||||
|
||||
HTTP_ACTIONS = {
|
||||
'GET': 'view',
|
||||
@ -210,6 +210,8 @@ class ModelViewSet(BulkUpdateModelMixin, BulkDestroyModelMixin, ModelViewSet_):
|
||||
*args,
|
||||
**kwargs
|
||||
)
|
||||
except Exception as e:
|
||||
return rest_api_server_error(request, *args, **kwargs)
|
||||
|
||||
def _validate_objects(self, instance):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user