jsonrpc.exception

Exception base class inspired by Adam Ruppe's exception.d

Error messages include the names and values of relevant data, but no further introspection capabilities.

Members

Classes

ConnectionException
class ConnectionException

Raised when there's a network connection error.

IncorrectType
class IncorrectType

Raised when attempting to access a JSONValue via a different type than the underlying type.

InvalidArgument
class InvalidArgument

Raised when invalid data is passed as an argument to a function.

InvalidDataReceived
class InvalidDataReceived

Raised when invalid data is received by the client or server.

RPCErrorResponse
class RPCErrorResponse

Raised when a function call via RPCClient.opDispatch receives an error response.

Functions

enforce
auto enforce(bool val, string msg = "", string file = __FILE__, size_t line = __LINE__)

Raise the specified exception of the provided expression evaluates to false.

raise
void raise(string msg = "", string file = __FILE__, size_t line = __LINE__)

Generate and throw an exception.

Examples

1 /* Where InvalidArgumment is defined as:
2 class InvalidArgument : Exception {
3     this() { super(""); }
4 }
5 */
6 
7 void func(bool one, bool two) {
8     if (one == two) {
9         raise!(InvalidArgument, one, two)("The values shouldn't match!");
10     }
11 }
12 func(false, true);

Meta