1 # <small>nlohmann::basic_json::</small>out_of_range
4 class out_of_range : public exception;
7 This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for
8 instance in case of array indices or nonexisting object keys.
10 Exceptions have ids 4xx (see [list of out-of-range errors](../../home/exceptions.md#out-of-range)).
13 std::exception <|-- basic_json::exception
14 basic_json::exception <|-- basic_json::parse_error
15 basic_json::exception <|-- basic_json::invalid_iterator
16 basic_json::exception <|-- basic_json::type_error
17 basic_json::exception <|-- basic_json::out_of_range
18 basic_json::exception <|-- basic_json::other_error
20 interface std::exception {}
22 class basic_json::exception {
24 + const char* what() const
27 class basic_json::parse_error {
28 + const std::size_t byte
31 class basic_json::out_of_range #FFFF00 {}
36 - **what** - returns explanatory string
40 - **id** - the id of the exception
46 The following code shows how a `out_of_range` exception can be caught.
49 --8<-- "examples/out_of_range.cpp"
55 --8<-- "examples/out_of_range.output"
60 - [List of out-of-range errors](../../home/exceptions.md#out-of-range)
61 - [`parse_error`](parse_error.md) for exceptions indicating a parse error
62 - [`invalid_iterator`](invalid_iterator.md) for exceptions indicating errors with iterators
63 - [`type_error`](type_error.md) for exceptions indicating executing a member function with a wrong type
64 - [`other_error`](other_error.md) for exceptions indicating other library errors
68 - Since version 3.0.0.