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

{{cookiecutter.project_slug}}.app.hooks.error   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 11
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A http_exception_handler() 0 2 1
A broad_exception_handler() 0 9 2
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