Ejemplo n.º 1
0
 public void setErrResponse(Exception ex, Response response) {
   if (ex instanceof java.sql.SQLException
       || ex instanceof com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
       || ex instanceof org.springframework.jdbc.BadSqlGrammarException
       || ex instanceof org.springframework.dao.InvalidDataAccessApiUsageException
       || ex instanceof org.springframework.dao.DataAccessException
       || ex instanceof org.springframework.web.util.NestedServletException
       || ex
           instanceof com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException) {
     response.setResponseMsg(ex.getMessage());
     response.setResponseStatus(ConstException.ERR_CODE_DB_ERROR);
   } else if (ex instanceof java.lang.NullPointerException) {
     response.setResponseMsg(ex.getMessage());
     response.setResponseStatus(ConstException.ERR_CODE_UNKNOWN);
   } else if (ex instanceof ConstException) {
     ConstException constException = (ConstException) ex;
     response.setResponseMsg(constException.getMessage());
     response.setResponseStatus(constException.getCode());
   } else if (ex instanceof java.lang.IllegalThreadStateException) {
     response.setResponseMsg(ex.getMessage());
     response.setResponseStatus(ConstException.ERR_CODE_INVALID_THREAD_STOP);
   } else {
     setErrResponse(ex, response, ConstException.ERR_CODE_UNKNOWN);
   }
 }
Ejemplo n.º 2
0
 public void setSuccessResponse(Response response, Object data) {
   response.setResponseStatus(ConstException.ERR_CODE_SUCCESS);
   response.setResponseMsg(ConstException.ERR_MSG_SUCCESS);
   response.setResponseData(data);
 }
Ejemplo n.º 3
0
 public void setErrResponse(Exception ex, Response response, int errCode) {
   ConstException constException = (ConstException) ex;
   response.setResponseMsg(constException.getMessage());
   response.setResponseStatus(constException.getCode());
 }