exception indicating errors with iterators More...
#include <json.hpp>
Static Public Member Functions | |
static invalid_iterator | create (int id_, const std::string &what_arg) |
Additional Inherited Members | |
Public Member Functions inherited from nlohmann::detail::exception | |
JSON_HEDLEY_RETURNS_NON_NULL const char * | what () const noexcept override |
returns the explanatory string More... | |
Public Attributes inherited from nlohmann::detail::exception | |
const int | id |
the id of the exception More... | |
Protected Member Functions inherited from nlohmann::detail::exception | |
exception (int id_, const char *what_arg) | |
Static Protected Member Functions inherited from nlohmann::detail::exception | |
static std::string | name (const std::string &ename, int id_) |
exception indicating errors with iterators
This exception is thrown if iterators passed to a library function do not match the expected semantics.
Exceptions have ids 2xx.
name / id | example message | description |
---|---|---|
json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (first, last) is invalid. |
json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. |
json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. |
json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (begin(), end()), because this is the only way the single stored value is expressed. All other ranges are invalid. |
json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the begin() iterator, because it is the only way to address the stored value. All other iterators are invalid. |
json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range. |
json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. |
json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. |
json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. |
json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (first, last) is invalid. |
json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to. |
json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container. |
json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered. |
json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to begin(). |
@liveexample{The following code shows how an invalid_iterator
exception can be caught.,invalid_iterator}
|
static |
References nlohmann::detail::exception::name().
Referenced by draftguitools.gui_labels.Label::action(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::basic_json(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::erase(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::insert(), nlohmann::detail::iter_impl< BasicJsonType >::key(), nlohmann::detail::iter_impl< BasicJsonType >::operator*(), nlohmann::detail::iter_impl< BasicJsonType >::operator+=(), nlohmann::detail::iter_impl< BasicJsonType >::operator-(), nlohmann::detail::iter_impl< BasicJsonType >::operator->(), nlohmann::detail::iter_impl< BasicJsonType >::operator<(), nlohmann::detail::iter_impl< BasicJsonType >::operator==(), nlohmann::detail::iter_impl< BasicJsonType >::operator[](), and nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::update().