示例#1
0
文件: views.py 项目: FlorianHeigl/ncf
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
示例#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