Esempio n. 1
0
def format_error(exception, when, code):
    if not isinstance(exception, ncf.NcfError):
        exception = ncf.NcfError(
            "Unknown internal error during " + when, "Cause: " + str(exception) + "\n" + traceback.format_exc()
        )
    error = jsonify({"error": ncf.format_errors([exception])})
    error.status_code = code
    return error
Esempio n. 2
0
def format_error(exception, when, code):
    if not isinstance(exception, ncf.NcfError):
        exception = ncf.NcfError(
            "Unknown internal error during " + when,
            "Cause: " + str(exception) + "\n" + traceback.format_exc())
    error = jsonify({"error": ncf.format_errors([exception])})
    error.status_code = code
    return error