MCPcopy
hub / github.com/smittix/intercept / api_error

Function api_error

utils/responses.py:26–37  ·  view source on GitHub ↗

Return an error JSON response. Args: message: Human-readable error message. status_code: HTTP status code (default 400). error_type: Optional machine-readable error category (e.g. 'DEVICE_BUSY').

(message, status_code=400, error_type=None)

Source from the content-addressed store, hash-verified

24
25
26def api_error(message, status_code=400, error_type=None):
27 """Return an error JSON response.
28
29 Args:
30 message: Human-readable error message.
31 status_code: HTTP status code (default 400).
32 error_type: Optional machine-readable error category (e.g. 'DEVICE_BUSY').
33 """
34 payload = {'status': 'error', 'message': message}
35 if error_type:
36 payload['error_type'] = error_type
37 return jsonify(payload), status_code

Callers 15

sigidwiki_lookupFunction · 0.90
start_recordingFunction · 0.90
stop_recordingFunction · 0.90
get_recordingFunction · 0.90
download_recordingFunction · 0.90
get_recording_eventsFunction · 0.90
start_sensorFunction · 0.90
start_bt_scanFunction · 0.90
reset_bt_adapterFunction · 0.90
enum_bt_servicesFunction · 0.90
check_updatesFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_resolve_rpaFunction · 0.72