This repository has been archived on 2023-02-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-my-data/web/exceptions.py
2018-07-23 20:19:47 +02:00

22 lines
615 B
Python

from rest_framework.exceptions import APIException, _get_error_details
class ServiceUnavailable(APIException):
status_code = 503
default_detail = 'Service temporarily unavailable, try again later.'
default_code = 'service_unavailable'
class ServiceBadRequest(APIException):
status_code = 400
default_detail = 'Bad Request'
default_code = 'bad_request'
def __init__(self, detail=None, code=None):
if detail is None:
detail = self.default_detail
if code is None:
code = self.default_code
self.detail = _get_error_details(detail, code)