exceptions.py 313 B

123456789101112
  1. from rest_framework.exceptions import APIException
  2. import json
  3. class PdnsException(APIException):
  4. def __init__(self, response):
  5. self.status_code = response.status_code
  6. try:
  7. self.detail = json.loads(response.text)['error']
  8. except:
  9. self.detail = response.text