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

io.gitee.huangguiming.Imcode.exception.IMException Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
package io.gitee.huangguiming.Imcode.exception;

public class IMException extends Exception{
    private static final long serialVersionUID = -6357149550353160810L;

    private final IMError error;

    private static final int DEFAULT_ERROR_CODE = -99;

    public IMException(String message) {
        this(IMError.builder().ErrorCode(DEFAULT_ERROR_CODE).ErrorInfo(message).build());
    }

    public IMException(IMError error) {
        super(error.toString());
        this.error = error;
    }

    public IMException(IMError error, Throwable cause) {
        super(error.toString(), cause);
        this.error = error;
    }

    public IMException(Throwable cause) {
        super(cause.getMessage(), cause);
        this.error = IMError.builder().ErrorCode(DEFAULT_ERROR_CODE).ErrorInfo(cause.getMessage()).build();
    }

    public IMError getError() {
        return this.error;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy