MCPcopy Create free account
hub / github.com/tiny-pilot/tinypilot / error

Function error

app/json_response.py:18–35  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

16
17
18def 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 })

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected