improve exception handle

This commit is contained in:
Sola
2015-12-16 15:57:38 +08:00
parent 805e9c7837
commit 8aee2a047d
3 changed files with 6 additions and 6 deletions

View File

@@ -79,10 +79,10 @@ public class TicketQuery extends HttpServlet {
return new Response(Response.ResponseCode.ILLEGAL_PARAMETER); return new Response(Response.ResponseCode.ILLEGAL_PARAMETER);
} catch (HibernateException e) { } catch (HibernateException e) {
e.printStackTrace(); e.printStackTrace();
return new Response(Response.ResponseCode.DATABASE_ERROR, e); return new Response(Response.ResponseCode.DATABASE_ERROR, e.getMessage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new Response(Response.ResponseCode.INTERNAL_ERROR, e); return new Response(Response.ResponseCode.INTERNAL_ERROR, e.getMessage());
} }
} }

View File

@@ -79,10 +79,10 @@ public class TicketSubmit extends HttpServlet {
return new Response(Response.ResponseCode.ILLEGAL_PARAMETER); return new Response(Response.ResponseCode.ILLEGAL_PARAMETER);
} catch (HibernateException e) { } catch (HibernateException e) {
e.printStackTrace(); e.printStackTrace();
return new Response(Response.ResponseCode.DATABASE_ERROR); return new Response(Response.ResponseCode.DATABASE_ERROR, e.getMessage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new Response(Response.ResponseCode.INTERNAL_ERROR, e); return new Response(Response.ResponseCode.INTERNAL_ERROR, e.getMessage());
} }
} }

View File

@@ -73,10 +73,10 @@ public class TicketUpdate extends HttpServlet {
return new Response(Response.ResponseCode.ILLEGAL_PARAMETER); return new Response(Response.ResponseCode.ILLEGAL_PARAMETER);
} catch (HibernateException e) { } catch (HibernateException e) {
e.printStackTrace(); e.printStackTrace();
return new Response(Response.ResponseCode.DATABASE_ERROR, e); return new Response(Response.ResponseCode.DATABASE_ERROR, e.getMessage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new Response(Response.ResponseCode.INTERNAL_ERROR, e); return new Response(Response.ResponseCode.INTERNAL_ERROR, e.getMessage());
} }
} }