exception

重畳例外

重畳例外 throw DuplicationUserIdException(e) or throw DuplicationUserIdException().initCause(e);

例外転換(exception transition)

例外転換:意味は確かな例外に転換して投げる catch(SQLException e) { if (e.getErrorCode() == MysqlErrorNumbers.ER_DUP_ENTRY) throw DuplicateUserIdException(); else throw e; }

checked exception & unchecked exception

JavaのExceptionには二つの種類があるunchecked exception - RuntimeExceptionを承継したexceptionクラス checked exception - checked exception以外のexceptionクラス◯例外を回避するときは必ず意図がはっきりしなか行けない。