Passed
Push — master ( 526772...94ac74 )
by Mingyu
01:21
created

app.error_handlers   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 15
dl 0
loc 20
rs 10
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A broad_exception_error_handler() 0 4 1
A http_exception_handler() 0 4 1
A validation_error_handler() 0 4 1
1
from flask import jsonify
2
3
4
def http_exception_handler(e):
5
    return jsonify({
6
        'msg': e.description
7
    }), e.code
8
9
10
def validation_error_handler(e):
11
    return jsonify({
12
        'msg': e.description
13
    }), 400
14
15
16
def broad_exception_error_handler(e):
17
    return jsonify({
18
        'msg': str(e),
19
    }), 500
20