Skip to main content

py_err_json

No overview available.

def py_err_json(
error: Exception
) - > string

Converts a Python exception into a JSON-formatted string containing the error type and message. Use this to standardize error reporting in API responses or logging systems.

Parameters

NameTypeDescription
errorExceptionThe Python exception object to be serialized into JSON format.

Returns

TypeDescription
stringA JSON string with 'error' and 'message' keys representing the exception details.