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, size_t line)

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

raise
void raise(string msg, string file, size_t line)

Generate and throw an exception.

Examples

/* Where InvalidArgumment is defined as:
class InvalidArgument : Exception {
    this() { super(""); }
}
*/

void func(bool one, bool two) {
    if (one == two) {
        raise!(InvalidArgument, one, two)("The values shouldn't match!");
    }
}
func(false, true);

Meta