add traceback info

This commit is contained in:
yumoqing 2019-11-27 13:50:55 +08:00
parent 7101e86d57
commit 487087c4c3

View File

@ -1,5 +1,6 @@
import os import os
import re import re
import traceback
from aiohttp.web_urldispatcher import StaticResource, _WebHandler, PathLike from aiohttp.web_urldispatcher import StaticResource, _WebHandler, PathLike
from aiohttp.web_urldispatcher import Optional, _ExpectHandler from aiohttp.web_urldispatcher import Optional, _ExpectHandler
@ -62,6 +63,7 @@ class DBCrud(RestEndpoint):
self.crud = CRUD(dbname,tablename) self.crud = CRUD(dbname,tablename)
except Exception as e: except Exception as e:
print('e=',e) print('e=',e)
traceback.print_exc()
raise HTTPNotFound raise HTTPNotFound
async def options(self) -> Response: async def options(self) -> Response:
@ -70,6 +72,7 @@ class DBCrud(RestEndpoint):
return json_response(Success(d)) return json_response(Success(d))
except Exception as e: except Exception as e:
print(e) print(e)
traceback.print_exc()
return json_response(Error(errno='metaerror',msg='get metadata error')) return json_response(Error(errno='metaerror',msg='get metadata error'))
async def get(self) -> Response: async def get(self) -> Response:
@ -84,6 +87,7 @@ class DBCrud(RestEndpoint):
return json_response(Success(d)) return json_response(Success(d))
except Exception as e: except Exception as e:
print(e) print(e)
traceback.print_exc()
return json_response(Error(errno='search error',msg='search error')) return json_response(Error(errno='search error',msg='search error'))
async def post(self): async def post(self):
@ -96,6 +100,7 @@ class DBCrud(RestEndpoint):
return json_response(Success(d)) return json_response(Success(d))
except Exception as e: except Exception as e:
print(e) print(e)
traceback.print_exc()
return json_response(Error(errno='add error',msg='add error')) return json_response(Error(errno='add error',msg='add error'))
async def put(self): async def put(self):
@ -108,6 +113,7 @@ class DBCrud(RestEndpoint):
return json_response(Success('')) return json_response(Success(''))
except Exception as e: except Exception as e:
print(e) print(e)
traceback.print_exc()
return json_response(Error(errno='update error',msg='update error')) return json_response(Error(errno='update error',msg='update error'))
async def delete(self, request: Request, instance_id): async def delete(self, request: Request, instance_id):
@ -120,4 +126,5 @@ class DBCrud(RestEndpoint):
return json_response(Success(d)) return json_response(Success(d))
except Exception as e: except Exception as e:
print(e) print(e)
traceback.print_exc()
return json_response(Error(erron='delete error',msg='error')) return json_response(Error(erron='delete error',msg='error'))