Passed
Push — master ( 622bd5...daf764 )
by Mingyu
57s
created

broad_exception_handler()   A

Complexity

Conditions 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 2
nop 1
1
from flask import current_app, jsonify
2
from werkzeug.exceptions import HTTPException
3
4
5
def http_exception_handler(e: HTTPException):
6
    return jsonify({"message": e.description}), e.code
7
8
9
def broad_exception_handler(e: Exception):
10
    # TODO 에러를 세분화해서 잡는 것을 추천합니다.
11
12
    if current_app.debug:
13
        import traceback
14
15
        traceback.print_exc()
16
17
    return "", 500
18