]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/mkdocs/docs/api/basic_json/type_error.md
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / mkdocs / docs / api / basic_json / type_error.md
1 # <small>nlohmann::basic_json::</small>type_error
2
3 ```cpp
4 class type_error : public exception;
5 ```
6
7 This exception is thrown in case of a type error; that is, a library function is executed on a JSON value whose type
8 does not match the expected semantics.
9
10 Exceptions have ids 3xx (see [list of type errors](../../home/exceptions.md#type-errors)).
11
12 ```plantuml
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
19
20 interface std::exception {}
21
22 class basic_json::exception {
23 + const int id
24 + const char* what() const
25 }
26
27 class basic_json::parse_error {
28 + const std::size_t byte
29 }
30
31 class basic_json::type_error #FFFF00 {}
32 ```
33
34 ## Member functions
35
36 - **what** - returns explanatory string
37
38 ## Member variables
39
40 - **id** - the id of the exception
41
42 ## Examples
43
44 ??? example
45
46 The following code shows how a `type_error` exception can be caught.
47
48 ```cpp
49 --8<-- "examples/type_error.cpp"
50 ```
51
52 Output:
53
54 ```json
55 --8<-- "examples/type_error.output"
56 ```
57
58 ## See also
59
60 - [List of type errors](../../home/exceptions.md#type-errors)
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 - [`out_of_range`](out_of_range.md) for exceptions indicating access out of the defined range
64 - [`other_error`](other_error.md) for exceptions indicating other library errors
65
66 ## Version history
67
68 - Since version 3.0.0.