DBuildService / dbs-server

BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

allways return JsonResponse from REST views #5

Closed misli closed 9 years ago

misli commented 9 years ago

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.

TomasTomecek commented 9 years ago

resolved by https://github.com/DBuildService/dbs-server/commit/9a18b583d3c0568fcb644746050b3219df33fac0 .. https://github.com/DBuildService/dbs-server/commit/08ce1d8ccf593cb43c7f2ca83c8087d51ec3f7b7