Handle all exceptions and return JsonResponse with appropriate message.
The best solution is to wrap the responses to structure:
{ 'status': 200, 'message': 'OK', 'data': }
In case of error you may return:
{ 'status': 500, 'message': 'Unhandled FooException(x, y, z)' }
The best way to achieve this is to use class based views.
Handle all exceptions and return JsonResponse with appropriate message. The best solution is to wrap the responses to structure: { 'status': 200, 'message': 'OK', 'data': }
In case of error you may return:
{ 'status': 500, 'message': 'Unhandled FooException(x, y, z)' }
The best way to achieve this is to use class based views.