io.gitee.huangguiming.Imcode.exception.IMException Maven / Gradle / Ivy
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;
}
}