CUDNN Frontend API 8.3.0

Static Public Member Functions | Private Member Functions | List of all members
nlohmann::detail::type_error Class Reference

exception indicating executing a member function with a wrong type More...

`#include <json.hpp>`

Inheritance diagram for nlohmann::detail::type_error:
Collaboration diagram for nlohmann::detail::type_error:

## Static Public Member Functions
template<typename BasicJsonType >
static type_error | create (int id_, const std::string &what_arg, const BasicJsonType &context)

## Private Member Functions
| type_error (int id_, const char *what_arg)

## Additional Inherited Members
Public Member Functions inherited from nlohmann::detail::exception
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_)
template<typename BasicJsonType >
static std::string | diagnostics (const BasicJsonType &leaf_element)

## Detailed Description

exception indicating executing a member function with a wrong type

This exception is thrown in case of a type error; that is, a library function is executed on a JSON value whose type does not match the expected semantics.

Exceptions have ids 3xx.

name / id | example message | description
--- | --- | ---
json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead.
json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types.
json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a basic_json object with get_ref, the type of the reference must match the value type. For instance, for a JSON array, the ReferenceType must be array_t &.
json.exception.type_error.304 | cannot use at() with string | The at() member functions can only be executed for certain JSON types.
json.exception.type_error.305 | cannot use operator[] with string | The operator[] member functions can only be executed for certain JSON types.
json.exception.type_error.306 | cannot use value() with string | The value() member functions can only be executed for certain JSON types.
json.exception.type_error.307 | cannot use erase() with string | The erase() member functions can only be executed for certain JSON types.
json.exception.type_error.308 | cannot use push_back() with string | The push_back() and operator+= member functions can only be executed for certain JSON types.
json.exception.type_error.309 | cannot use insert() with | The insert() member functions can only be executed for certain JSON types.
json.exception.type_error.310 | cannot use swap() with number | The swap() member functions can only be executed for certain JSON types.
json.exception.type_error.311 | cannot use emplace_back() with string | The emplace_back() member function can only be executed for certain JSON types.
json.exception.type_error.312 | cannot use update() with string | The update() member functions can only be executed for certain JSON types.
json.exception.type_error.313 | invalid value to unflatten | The unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined.
json.exception.type_error.314 | only objects can be unflattened | The unflatten function only works for an object whose keys are JSON Pointers.
json.exception.type_error.315 | values in object must be primitive | The unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive.
json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded.
json.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON)

{The following code shows how a `type_error` exception can be caught.,type_error}

See also
  - exception for the base class of the library exceptions
  - parse_error for exceptions indicating a parse error
  - invalid_iterator for exceptions indicating errors with iterators
  - out_of_range for exceptions indicating access out of the defined range
  - other_error for exceptions indicating other library errors

Since
  version 3.0.0

Definition at line 2912 of file json.hpp.

## Constructor & Destructor Documentation

## ◆ type_error()

nlohmann::detail::type_error::type_error | ( | int | id_,
|  | const char * | what_arg
| ) |  |
| inlineprivate

Definition at line 2924 of file json.hpp.

## Member Function Documentation

## ◆ create()

template<typename BasicJsonType >

static type_error nlohmann::detail::type_error::create | ( | int | id_,
|  | const std::string & | what_arg,
|  | const BasicJsonType & | context
| ) |  |
| inlinestatic

Definition at line 2916 of file json.hpp.

References nlohmann::detail::exception::diagnostics(), JSON_HEDLEY_NON_NULL, nlohmann::detail::exception::name(), and nlohmann::detail::string.

Referenced by nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::at(), 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 >::emplace(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::emplace_back(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::erase(), nlohmann::detail::serializer< BasicJsonType >::for(), nlohmann::detail::from_json(), nlohmann::json_pointer< BasicJsonType >::get_and_create(), nlohmann::detail::get_arithmetic_value(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::get_binary(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::get_impl(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::get_ref_impl(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::insert(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::operator[](), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::push_back(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::swap(), nlohmann::json_pointer< BasicJsonType >::unflatten(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::update(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::value(), nlohmann::detail::void(), and nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson().

The documentation for this class was generated from the following file:

- json.hpp