Javaの独自例外
Javaの独自例外サンプルです。
package jp.co.confrage.infrastructure.exception;
import jp.co.confrage.infrastructure.constant.EmitStatus;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@NoArgsConstructor
@Getter
@Setter
public class HogeException extends Exception {
/**
* コンストラクタ.
*
* @param status Hogeステータス
*/
public HogeException(HogeStatus status) {
this.status = status.getStatus();
this.emitErrorCode = status.getCode();
}
private static final long serialVersionUID = 1L;
private Integer status;
private String emitErrorCode;
}
package jp.co.confrage.infrastructure.constant;
/**
* Hoge定義のレスポンスステータス.
*
*/
public enum HogeStatus {
/** 正常終了. */
SUCCESS(200, ""),
/** 正常終了. */
SUCCESS_ASYNC(202, ""),
;
private Integer status;
private String code;
HogeStatus(final Integer status, final String code) {
this.status = status;
this.code = code;
}
public Integer getStatus() {
return status;
}
public String getCode() {
return code;
}
}

KHI入社して退社。今はCONFRAGEで正社員です。関西で140-170/80~120万から受け付けております^^
得意技はJS(ES20xx),Java,AWSの大体のリソースです
コメントはやさしくお願いいたします^^
座右の銘は、「狭き門より入れ」「願わくは、我に七難八苦を与えたまえ」です^^


コメント