-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathginger.py
More file actions
33 lines (27 loc) · 798 Bytes
/
ginger.py
File metadata and controls
33 lines (27 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018/12/14 16:21
# @Author: yanmiexingkong
# @email : yanmiexingkong@gmail.com
# @File : ginger.py
from werkzeug.exceptions import HTTPException
from app import create_app
from app.libs.error import APIException
from app.libs.error_code import ServerError
app = create_app()
@app.errorhandler(Exception)
def framework_error(e):
if isinstance(e, APIException):
return e
if isinstance(e, HTTPException):
code = e.code
msg = e.description
error_code = 1007
return APIException(msg, code, error_code)
else:
if app.config["DEBUG"]:
raise e
else:
return ServerError()
if __name__ == "__main__":
app.run(host="127.0.0.1", port=6000, debug=True)