Reflection for RapidJSON
0.0.15
Reflection for serializing/deserializing with RapidJSON
|
Go to the documentation of this file. 1 #ifndef REFLECTIVE_RAPIDJSON_JSON_ERROR_FORMATTING_H
2 #define REFLECTIVE_RAPIDJSON_JSON_ERROR_FORMATTING_H
11 #include <c++utilities/conversion/stringbuilder.h>
13 #include <string_view>
39 using namespace CppUtilities;
40 std::string_view errorKind;
41 std::string additionalInfo;
44 errorKind =
"type mismatch";
48 errorKind =
"array size mismatch";
51 errorKind =
"conversion error";
54 errorKind =
"unexpected duplicate";
57 errorKind =
"invalid variant object";
60 errorKind =
"invalid variant index";
63 errorKind =
"semantic error";
66 return errorKind %
" within record \"" % error.
record %
"\" and member \"" % error.
member %
'\"' + additionalInfo;
68 return errorKind %
" within record \"" % error.
record %
"\" and index \"" % error.
index %
'\"' + additionalInfo;
70 return errorKind %
" within record \"" % error.
record %
'\"' + additionalInfo;
72 return errorKind %
" in document" + additionalInfo;
78 #endif // REFLECTIVE_RAPIDJSON_JSON_ERROR_FORMATTING_H
constexpr JsonType jsonType()
JsonDeserializationErrorKind kind
Which kind of error occured.
JsonType
The JsonType enum specifies the JSON data type.
JsonType expectedType
The expected type (might not be relevant for all error kinds).
Contains helper for error handling when deserializing JSON files.
const char * member
The name of the member which was being processed when the error was ascertained.
static constexpr std::size_t noIndex
Indicates no array was being processed when the error occured.
std::size_t index
The index in the array which was being processed when the error was ascertained.
The JsonDeserializationError struct describes any errors of fromJson() except such caused by invalid ...
JsonType actualType
The actual type (might not be relevant for all error kinds).
std::string formatJsonDeserializationError(const JsonDeserializationError &error)
std::string_view jsonTypeToString(JsonType jsonType)
const char * record
The name of the class or struct which was being processed when the error was ascertained.