카테고리 없음
[JAVA] 자바 예외를 SQLException로 형변환 DB에러코드로 핸들링
try {
list = wmsDao.queryForList("", paramMap);
}catch(RuntimeException e) {
Throwable cause = e.getCause();
if(cause.getCause().getCause() instanceof SQLException) {
int sqlErrCode = ((SQLException)cause.getCause().getCause()).getErrorCode();
if(sqlErrCode == 1489) {//ORA_01795
throw new TestException("에러메세지~");
}
throw new TestException(e);
}
throw new TestException(e);
}
댓글