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

com.leftins.tools.exception.NormalException Maven / Gradle / Ivy

package com.leftins.tools.exception;

import com.leftins.tools.result.ResultCode;

import java.text.MessageFormat;

public class NormalException extends RuntimeException {
    //错误代码
    int code;
    String message;

    public NormalException(ResultCode resultCode) {
        super(resultCode.message());
        this.code = resultCode.code();
        this.message = resultCode.message();
    }

    public NormalException(ResultCode resultCode, Object... args) {
        super(resultCode.message());
        String message = MessageFormat.format(resultCode.message(), args);
        resultCode.setMessage(message);
        this.code = resultCode.code();
        this.message = resultCode.message();
    }
    public NormalException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy