1#ifndef REFLECTIVE_RAPIDJSON_JSON_ERROR_FORMATTING_H
2#define REFLECTIVE_RAPIDJSON_JSON_ERROR_FORMATTING_H
11#include <c++utilities/conversion/stringbuilder.h>
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;
Contains helper for error handling when deserializing JSON files.
std::string formatJsonDeserializationError(const JsonDeserializationError &error)
std::string_view jsonTypeToString(JsonType jsonType)
JsonType
The JsonType enum specifies the JSON data type.
constexpr JsonType jsonType()
The JsonDeserializationError struct describes any errors of fromJson() except such caused by invalid ...
JsonType expectedType
The expected type (might not be relevant for all error kinds).
std::size_t index
The index in the array which was being processed when the error was ascertained.
JsonType actualType
The actual type (might not be relevant for all error kinds).
const char * member
The name of the member which was being processed when the error was ascertained.
const char * record
The name of the class or struct which was being processed when the error was ascertained.
static constexpr std::size_t noIndex
Indicates no array was being processed when the error occurred.
JsonDeserializationErrorKind kind
Which kind of error occurred.