|
@@ -4,9 +4,12 @@ import json
|
|
|
|
|
|
class PdnsException(APIException):
|
|
|
|
|
|
- def __init__(self, response):
|
|
|
- self.status_code = response.status_code
|
|
|
- try:
|
|
|
- self.detail = json.loads(response.text)['error']
|
|
|
- except:
|
|
|
- self.detail = response.text
|
|
|
+ def __init__(self, response=None, detail=None, status=None):
|
|
|
+ self.status_code = status or response.status_code
|
|
|
+ if detail:
|
|
|
+ self.detail = detail
|
|
|
+ else:
|
|
|
+ try:
|
|
|
+ self.detail = json.loads(response.text)['error']
|
|
|
+ except:
|
|
|
+ self.detail = response.text
|