File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11CHANGES
22=======
33
4+ 3.0.0
5+ -----
6+ * Return proper 404 and other errors
7+
483.0.0
59-----
610* Use v8 by default, lower timeout
Original file line number Diff line number Diff line change @@ -19,3 +19,18 @@ def test_bad_request():
1919
2020 with pytest .raises (BadRequest , match = "400, Bad or missing parameters" ) as e :
2121 raise VeryfiClientError .from_response (response )
22+
23+
24+ @responses .activate
25+ def test_not_found ():
26+ url = f"{ Client .BASE_URL } v7/partner/documents"
27+ responses .add (
28+ responses .PUT ,
29+ url ,
30+ json = {"status" : "fail" , "error" : "Document not found" },
31+ status = 404 ,
32+ )
33+ response = requests .put (url )
34+
35+ with pytest .raises (VeryfiClientError , match = "404, Document not found" ) as e :
36+ raise VeryfiClientError .from_response (response )
Original file line number Diff line number Diff line change @@ -20,18 +20,8 @@ def from_response(raw_response):
2020 'error': 'Human readable error description.'
2121 }
2222 """
23- json_response = raw_response .json ()
24- # TODO Add Error Codes to API response
25- # code = error_info.get("code", "")
26-
27- try :
28- error_cls = _error_map [raw_response .status_code ]
29- except KeyError :
30- raise NotImplementedError (
31- "Unknown error Please contact customer support at support@veryfi.com."
32- )
33- else :
34- return error_cls (raw_response , ** raw_response .json ())
23+ error_cls = _error_map .get (raw_response .status_code ) or VeryfiClientError
24+ return error_cls (raw_response , ** raw_response .json ())
3525
3626
3727class UnauthorizedAccessToken (VeryfiClientError ):
You can’t perform that action at this time.
0 commit comments