capnproto-java-rpc/runtime/src/main/java/org/capnproto/RpcException.java

35 lines
780 B
Java
Raw Normal View History

2020-09-28 07:32:52 +00:00
package org.capnproto;
public final class RpcException extends java.lang.Exception {
public enum Type {
2020-10-20 20:42:20 +00:00
FAILED,
2020-11-06 17:36:21 +00:00
OVERLOADED,
DISCONNECTED,
UNIMPLEMENTED
2020-09-28 07:32:52 +00:00
}
2020-11-06 17:36:21 +00:00
private final Type type;
2020-09-28 07:32:52 +00:00
public RpcException(Type type, String message) {
super(message);
this.type = type;
}
public final Type getType() {
return type;
}
public static RpcException unimplemented(String message) {
return new RpcException(Type.UNIMPLEMENTED, message);
}
public static RpcException failed(String message) {
return new RpcException(Type.FAILED, message);
}
2020-10-20 20:42:20 +00:00
public static RpcException disconnected(String message) {
return new RpcException(Type.DISCONNECTED, message);
}
2020-09-28 07:32:52 +00:00
}