package at.gv.egiz.moazs; import at.gv.zustellung.msg.xsd.PreAdviceNoteSentType; import org.springframework.lang.Nullable; public class MoaZSException extends RuntimeException { public static final String ERROR_MZS_MIMETYPE_MISSMATCH = "8001"; public static final String ERROR_MZS_NO_TNVZ_PERSON_QUERY_RESULTS = "8002"; public static final String ERROR_MZS_BINARY_RESPONSE_MISSING = "8003"; public static final String ERROR_MZS_RESPONSE_MISSING = "8004"; public static final String ERROR_MOASP_SIGNATURE_INVALID = "7001"; @Nullable private final String code; @Nullable private final PreAdviceNoteSentType preAdviceNoteSent; private MoaZSException(String message, Throwable cause, @Nullable String code, @Nullable PreAdviceNoteSentType preAdviceNoteSent) { super(message, cause); this.code = code; this.preAdviceNoteSent = preAdviceNoteSent; } @Nullable public String getCode() { return code; } @Nullable public PreAdviceNoteSentType getPreAdviceNoteSent() { return preAdviceNoteSent; } public static MoaZSException moaZSException(String message, Throwable cause) { return new MoaZSException(message, cause, null, null); } public static MoaZSException moaZSException(String message) { return new MoaZSException(message, null, null, null); } public static MoaZSException moaZSException(String message, String code) { return new MoaZSException(message, null, code, null); } public static MoaZSException moaZSException(String message, String code, Throwable cause) { return new MoaZSException(message, cause, code, null); } public static MoaZSException moaZSException(String message, String code, PreAdviceNoteSentType preAdviceNoteSent) { return new MoaZSException(message, null, code, preAdviceNoteSent); } }