Mapping error.
More...
#include <mappingError.hpp>
Mapping error.
Error which can be raised while parsing JSON input stream
- Author
- Vincent Lachenal
- Since
- 0.1
◆ MappingError() [1/3]
MappingError constructor
- Parameters
-
| code | the error code |
| context | the JSON context parser |
◆ MappingError() [2/3]
MappingError constructor with detailed message.
The message replaces the generic message of the error code ; the input around the error is still added.
- Parameters
-
| code | the error code |
| context | the JSON context parser |
| message | the detailed error message |
◆ MappingError() [3/3]
| anch::json::MappingError::MappingError |
( |
ErrorCode | code, |
|
|
std::string_view | message ) |
MappingError constructor without input (serialization error)
- Parameters
-
| code | the error code |
| message | the error message |
- Since
- 0.2
◆ ~MappingError()
| virtual anch::json::MappingError::~MappingError |
( |
| ) |
|
|
virtual |
◆ getErrorCode()
Error code getter
- Returns
- the error code
◆ getPath()
| const std::string & anch::json::MappingError::getPath |
( |
| ) |
const |
Path of the value in error getter.
The path is a JSON Pointer (RFC 6901) from the deserialized root value: /pets/3/name for the name field of the fourth item of the pets array. It is empty when the error is not in a field or array item value (root value, field name or separator).
When path is not empty, what() message starts with the path followed by ": " .
- Returns
- the path
- Since
- 0.2
◆ prependField()
| void anch::json::MappingError::prependField |
( |
std::string_view | field | ) |
|
Add object field at the beginning of the path. It is used by mappers when error is propagated from a field value.
- Parameters
-
| field | the field name (escaped according to JSON Pointer rules: ~ as ~0 and / as ~1 ) |
- Since
- 0.2
◆ prependIndex()
| void anch::json::MappingError::prependIndex |
( |
std::size_t | index | ) |
|
Add array index at the beginning of the path. It is used by mappers when error is propagated from an array item.
- Parameters
-
- Since
- 0.2
◆ what()
| virtual const char * anch::json::MappingError::what |
( |
| ) |
const |
|
overridevirtualnoexcept |
Error message getter
- Returns
- the error message
The documentation for this class was generated from the following file: