Boost C++ Libraries

PrevUpHomeNext

Type error

boost::taar::jsonrpc::error — JSON-RPC 2.0 error codes.

Synopsis

// In header: <boost/taar/jsonrpc/error.hpp>


enum error { success = 0, parse_error = -32700, invalid_request = -32600, 
             method_not_found = -32601, invalid_params = -32602, 
             internal_error = -32603 };

Description

Values follow the spec's reserved range. The general-purpose pre-defined codes (parse_error through internal_error) cover protocol-level failures; the application-error range (-32000..-32099) is left to the caller – the spec reserves it for "implementation-defined server errors" and we do not enumerate those here.

The enum is wired to error_category through make_error_code plus a boost::system::is_error_code_enum specialisation at the bottom of this header, so values convert implicitly to boost::system::error_code and can be returned from APIs that use boost::system::result.

The category is distinct from boost::taar::error_category so a soft-error handler can dispatch on code.category() == jsonrpc::error_category() to format failures as JSON-RPC envelopes rather than HTTP errors.

success
No error. Not a spec code.
parse_error
JSON could not be parsed.
invalid_request
Not a valid JSON-RPC request envelope.
method_not_found
Method does not exist or is not available.
invalid_params
Method parameters were invalid.
internal_error
Internal JSON-RPC error.

PrevUpHomeNext