All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.reactor.exception.CommonBusinessException Maven / Gradle / Ivy

The newest version!
package org.zodiac.reactor.exception;

public class CommonBusinessException extends I18nSupportException {

    private static final long serialVersionUID = 5872168458998358269L;

    private int status = 500;
    private String code;

    public CommonBusinessException(String message) {
        this(message, 500);
    }

    public CommonBusinessException(String message, int status, Object... args) {
        this(message, null, status, args);
    }

    public CommonBusinessException(String message, String code) {
        this(message, code, 500);
    }

    public CommonBusinessException(String message, String code, int status, Object... args) {
        super(message, args);
        this.code = code;
        this.status = status;
    }

    public CommonBusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public CommonBusinessException(String message, Throwable cause, int status) {
        super(message, cause);
        this.status = status;
    }

    public int getStatus() {
        return status;
    }

    public String getCode() {
        return code;
    }

    /**
     * Exception that do not populate the thread stack, in some cases that are not sensitive to the thread stack and are uncontrollable for exceptions (e.g., exceptions from unauthenticated requests) are good for performance.
     */
    public static class NoStackTrace extends CommonBusinessException {

        private static final long serialVersionUID = 380629144604702062L;

        public NoStackTrace(String message) {
            this(message, 500);
        }

        public NoStackTrace(String message, int status, Object... args) {
            this(message, null, status, args);
        }

        public NoStackTrace(String message, String code) {
            this(message, code, 500);
        }

        public NoStackTrace(String message, String code, int status, Object... args) {
            super(message, code, status, args);

        }

        public NoStackTrace(String message, Throwable cause) {
            super(message, cause);
        }

        public NoStackTrace(String message, Throwable cause, int status) {
            super(message, cause, status);
        }

        @Override
        public final synchronized Throwable fillInStackTrace() {
            return this;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy