File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,23 @@ To handle an exception you would do the following:
2626
2727.. code-block :: python
2828
29- try :
30- client.project(' invalid_id' )
31- except lokalise.errors.NotFound as err:
32- print (err.message)
33- print (err.status_code)
29+ try :
30+ project = client.project(" invalid" )
31+ except errors.BadRequest as e:
32+ print (" === Lokalise API Error ===" )
33+ print (" Type:" , type (e).__name__ )
34+ print (" Status code:" , e.status_code)
35+ print (" Message:" , e.message)
36+ print (" Headers:" , e.headers)
37+ print (" Raw text:" , e.raw_text)
38+
39+ if e.parsed:
40+ print (" --- Parsed error ---" )
41+ print (" Parsed status:" , e.parsed.status)
42+ print (" Parsed message:" , e.parsed.message)
43+ print (" Parsed reason:" , e.parsed.reason)
44+ print (" Parsed code:" , e.parsed.code)
45+ print (" Parsed details:" , e.parsed.details)
3446
3547 Rate limits
3648-----------
You can’t perform that action at this time.
0 commit comments