| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,15 @@ class Error(Exception): | |||
| 13 | 13 | ||
| 14 | 14 | class RemoteError(Error, IOError): | |
| 15 | 15 | '''There was some kind of error while interacting with the server.''' | |
| 16 | - pass | ||
| 16 | + | ||
| 17 | + #: The decoded JSON request which lead to this error, if available. | ||
| 18 | + request = None | ||
| 19 | + | ||
| 20 | + #: The decoded JSON response/result which lead to this error, if available. | ||
| 21 | + result = None | ||
| 22 | + | ||
| 23 | + #: The error code, if available. | ||
| 24 | + code = None | ||
| 17 | 25 | ||
| 18 | 26 | ||
| 19 | 27 | class MethodNotFoundError(RemoteError): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,14 +120,11 @@ def _parse_error_code(request_body, result_body): | |||
| 120 | 120 | message = ('Some error happened and there is no information provided ' | |
| 121 | 121 | 'what went wrong.') | |
| 122 | 122 | ||
| 123 | - cls = _errorcodes.get(code, errors.RemoteError) | ||
| 124 | - | ||
| 125 | - raise cls( | ||
| 126 | - message, | ||
| 127 | - result_body, | ||
| 128 | - request_body | ||
| 129 | - ) | ||
| 130 | - | ||
| 123 | + exc = _errorcodes.get(code, errors.RemoteError)(message) | ||
| 124 | + exc.request = request_body | ||
| 125 | + exc.result = result_body | ||
| 126 | + exc.code = code | ||
| 127 | + raise exc | ||
| 131 | 128 | ||
| 132 | 129 | def _send_request(url, data, headers, http_session=None): | |
| 133 | 130 | '''Sends a POST request given the endpoint URL, JSON-encodable data, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments