A JSON response for a failed request. Args: original_error: The original error object Returns: A `flask.Response` object with JSON body. The JSON contains two fields: - message: A string with the error message. - code: Either a string with a unique error cod
(original_error)
| 16 | |
| 17 | |
| 18 | def error(original_error): |
| 19 | """A JSON response for a failed request. |
| 20 | |
| 21 | Args: |
| 22 | original_error: The original error object |
| 23 | |
| 24 | Returns: |
| 25 | A `flask.Response` object with JSON body. The JSON contains two fields: |
| 26 | - message: A string with the error message. |
| 27 | - code: Either a string with a unique error code as string, or `null`. |
| 28 | This property is only set for errors that are handled explicitly by |
| 29 | the TinyPilot frontend. |
| 30 | """ |
| 31 | code = getattr(original_error, 'code', None) |
| 32 | return flask.jsonify({ |
| 33 | 'message': str(original_error), |
| 34 | 'code': code, |
| 35 | }) |
nothing calls this directly
no outgoing calls
no test coverage detected