org.tron.p2p.exception.P2pException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of libp2p Show documentation
Show all versions of libp2p Show documentation
libp2p is a p2p network SDK implemented in java language.
The newest version!
package org.tron.p2p.exception;
public class P2pException extends Exception {
private TypeEnum type;
public P2pException(TypeEnum type, String errMsg) {
super(errMsg);
this.type = type;
}
public P2pException(TypeEnum type, Throwable throwable) {
super(throwable);
this.type = type;
}
public P2pException(TypeEnum type, String errMsg, Throwable throwable) {
super(errMsg, throwable);
this.type = type;
}
public TypeEnum getType() {
return type;
}
public enum TypeEnum {
NO_SUCH_MESSAGE(1, "no such message"),
PARSE_MESSAGE_FAILED(2, "parse message failed"),
MESSAGE_WITH_WRONG_LENGTH(3, "message with wrong length"),
BAD_MESSAGE(4, "bad message"),
BAD_PROTOCOL(5, "bad protocol"),
TYPE_ALREADY_REGISTERED(6, "type already registered");
private Integer value;
private String desc;
TypeEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return value;
}
public String getDesc() {
return desc;
}
@Override
public String toString() {
return value + ", " + desc;
}
}
}