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

com.power.common.exception.BaseRuntimeException Maven / Gradle / Ivy

The newest version!
package com.power.common.exception;

import com.power.common.constants.BaseErrorCode;
import com.power.common.interfaces.IMessage;

/**
 * @author yu 2019/1/21.
 */
public class BaseRuntimeException extends RuntimeException implements IMessage {

    private String errorCode;

    protected BaseRuntimeException(String message) {
        super(message);
        this.errorCode = BaseErrorCode.Common.UNKNOWN_ERROR.getCode();
    }

    protected BaseRuntimeException(IMessage iMessage) {
        super(iMessage.getMessage());
        this.errorCode = iMessage.getCode();
    }

    protected BaseRuntimeException(IMessage iMessage, String message) {
        super(message);
        this.errorCode = iMessage.getCode();
    }


    protected BaseRuntimeException(String errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }


    @Override
    public String getCode() {
        return this.errorCode;
    }

    @Override
    public String getMessage() {
        return super.getMessage();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy