2021-03-02 01:28:48 +00:00
|
|
|
module msgpackrpc.protocol;
|
|
|
|
|
2021-04-09 12:46:21 +00:00
|
|
|
version(WithRPC) {
|
2021-01-22 18:06:44 +00:00
|
|
|
import std.exception;
|
|
|
|
|
|
|
|
import msgpack;
|
|
|
|
|
|
|
|
enum MessageType {
|
|
|
|
request = 0,
|
|
|
|
response = 1,
|
|
|
|
notify = 2
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Thrown when the wire protocol could not be parsed.
|
|
|
|
*/
|
|
|
|
class ProtocolException : Exception {
|
|
|
|
mixin basicExceptionCtors;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Thrown when the other endpoint reports an error.
|
|
|
|
*/
|
|
|
|
class RPCException : Exception {
|
|
|
|
private:
|
|
|
|
Value m_value;
|
|
|
|
public:
|
|
|
|
this(Value value, string file = __FILE__, int line = __LINE__, Throwable next = null) {
|
|
|
|
super(value.as!string, file, line, next);
|
|
|
|
this.m_value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
@property Value value() { return m_value; }
|
|
|
|
|
|
|
|
}
|
2021-04-09 12:46:21 +00:00
|
|
|
|
|
|
|
} // version(WithRPC)
|