1# <small>nlohmann::basic_json::</small>invalid_iterator 2 3```cpp 4class invalid_iterator : public exception; 5``` 6 7This exception is thrown if iterators passed to a library function do not match the expected semantics. 8 9Exceptions have ids 2xx (see [list of iterator errors](../../home/exceptions.md#iterator-errors)). 10 11```plantuml 12std::exception <|-- basic_json::exception 13basic_json::exception <|-- basic_json::parse_error 14basic_json::exception <|-- basic_json::invalid_iterator 15basic_json::exception <|-- basic_json::type_error 16basic_json::exception <|-- basic_json::out_of_range 17basic_json::exception <|-- basic_json::other_error 18 19interface std::exception {} 20 21class basic_json::exception { 22 + const int id 23 + const char* what() const 24} 25 26class basic_json::parse_error { 27 + const std::size_t byte 28} 29 30class basic_json::invalid_iterator #FFFF00 {} 31``` 32 33## Member functions 34 35- **what** - returns explanatory string 36 37## Member variables 38 39- **id** - the id of the exception 40 41## Examples 42 43??? example 44 45 The following code shows how a `invalid_iterator` exception can be caught. 46 47 ```cpp 48 --8<-- "examples/invalid_iterator.cpp" 49 ``` 50 51 Output: 52 53 ```json 54 --8<-- "examples/invalid_iterator.output" 55 ``` 56 57## See also 58 59- [List of iterator errors](../../home/exceptions.md#iterator-errors) 60- [`parse_error`](parse_error.md) for exceptions indicating a parse error 61- [`type_error`](type_error.md) for exceptions indicating executing a member function with a wrong type 62- [`out_of_range`](out_of_range.md) for exceptions indicating access out of the defined range 63- [`other_error`](other_error.md) for exceptions indicating other library errors 64 65## Version history 66 67- Since version 3.0.0. 68