16#ifndef RAPIDJSON_ERROR_ERROR_H_
17#define RAPIDJSON_ERROR_ERROR_H_
23RAPIDJSON_DIAG_OFF(padded)
39#ifndef RAPIDJSON_ERROR_CHARTYPE
40#define RAPIDJSON_ERROR_CHARTYPE char
52#ifndef RAPIDJSON_ERROR_STRING
53#define RAPIDJSON_ERROR_STRING(x) x
119 size_t Offset()
const {
return offset_; }
126 bool operator==(
const ParseResult& that)
const {
return code_ == that.code_; }
127 bool operator==(
ParseErrorCode code)
const {
return code_ == code; }
130 bool operator!=(
const ParseResult& that)
const {
return !(*
this == that); }
131 bool operator!=(
ParseErrorCode code)
const {
return !(*
this == code); }
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
ValidateErrorCode
Error codes when validating.
SchemaErrorCode
Error codes when validating.
#define RAPIDJSON_ERROR_CHARTYPE
Character type of error messages.
ParseErrorCode
Error code of parsing.
PointerParseErrorCode
Error code of JSON pointer parsing.
@ kValidateErrorMinProperties
Object has less members than 'minProperties' value.
@ kValidateErrorExclusiveMinimum
Number is less than or equal to the 'minimum' value.
@ kValidateErrorAdditionalItems
Array has additional items that are not allowed by the schema.
@ kValidateErrorMaxProperties
Object has more members than 'maxProperties' value.
@ kValidateErrorOneOfMatch
Property matched more than one of the sub-schemas specified by 'oneOf'.
@ kValidateErrorRequired
Object is missing one or more members required by the schema.
@ kValidateErrorDependencies
Object has missing property or schema dependencies.
@ kValidateErrorUniqueItems
Array has duplicate items but 'uniqueItems' is true.
@ kValidateErrorReadOnly
Property is read-only but has been provided when validation is for writing.
@ kValidateErrorEnum
Property has a value that is not one of its allowed enumerated values.
@ kValidateErrorExclusiveMaximum
Number is greater than or equal to the 'maximum' value.
@ kValidateErrorType
Property has a type that is not allowed by the schema.
@ kValidateErrorOneOf
Property did not match any of the sub-schemas specified by 'oneOf'.
@ kValidateErrorMinLength
String is longer than the 'maxLength' value.
@ kValidateErrors
Top level error code when kValidateContinueOnErrorsFlag set.
@ kValidateErrorMaxLength
String is longer than the 'maxLength' value.
@ kValidateErrorWriteOnly
Property is write-only but has been provided when validation is for reading.
@ kValidateErrorAnyOf
Property did not match any of the sub-schemas specified by 'anyOf'.
@ kValidateErrorPattern
String does not match the 'pattern' regular expression.
@ kValidateErrorMaximum
Number is greater than the 'maximum' value.
@ kValidateErrorMaxItems
Array is longer than the 'maxItems' value.
@ kValidateErrorMinimum
Number is less than the 'minimum' value.
@ kValidateErrorMultipleOf
Number is not a multiple of the 'multipleOf' value.
@ kValidateErrorNone
No error.
@ kValidateErrorMinItems
Array is shorter than the 'minItems' value.
@ kValidateErrorNot
Property matched the sub-schema specified by 'not'.
@ kValidateErrorAdditionalProperties
Object has additional members that are not allowed by the schema.
@ kValidateErrorPatternProperties
See other errors.
@ kValidateErrorAllOf
Property did not match all of the sub-schemas specified by 'allOf'.
@ kSchemaErrorStartUnknown
Pointer to start of schema does not resolve to a location in the document.
@ kSchemaErrorSpecIllegal
Both JSON schema draft and OpenAPI version found in document.
@ kSchemaErrorSpecUnsupported
JSON schema draft or OpenAPI version is not supported.
@ kSchemaErrorRefPlainName
$ref fragment must be a JSON pointer
@ kSchemaErrorRefNoRemoteProvider
$ref is remote but there is no remote provider
@ kSchemaErrorSpecUnknown
JSON schema draft or OpenAPI version is not recognized.
@ kSchemaErrorRefUnknown
$ref does not resolve to a location in the target document
@ kSchemaErrorNone
No error.
@ kSchemaErrorRefPointerInvalid
$ref fragment is not a valid JSON pointer at offset
@ kSchemaErrorRefNoRemoteSchema
$ref is remote but the remote provider did not return a schema
@ kSchemaErrorRefCyclical
$ref is cyclical
@ kSchemaErrorRefInvalid
$ref must not be an empty string
@ kSchemaErrorRegexInvalid
Invalid regular expression in 'pattern' or 'patternProperties'.
@ kSchemaErrorReadOnlyAndWriteOnly
Property must not be both 'readOnly' and 'writeOnly'.
@ kParseErrorDocumentEmpty
The document is empty.
@ kParseErrorNumberMissFraction
Miss fraction part in number.
@ kParseErrorStringInvalidEncoding
Invalid encoding in string.
@ kParseErrorValueInvalid
Invalid value.
@ kParseErrorDocumentRootNotSingular
The document root must not follow by other values.
@ kParseErrorUnspecificSyntaxError
Unspecific syntax error.
@ kParseErrorObjectMissCommaOrCurlyBracket
Missing a comma or '}' after an object member.
@ kParseErrorObjectMissColon
Missing a colon after a name of object member.
@ kParseErrorStringMissQuotationMark
Missing a closing quotation mark in string.
@ kParseErrorTermination
Parsing was terminated.
@ kParseErrorNumberMissExponent
Miss exponent in number.
@ kParseErrorStringEscapeInvalid
Invalid escape character in string.
@ kParseErrorArrayMissCommaOrSquareBracket
Missing a comma or ']' after an array element.
@ kParseErrorNone
No error.
@ kParseErrorStringUnicodeSurrogateInvalid
The surrogate pair in string is invalid.
@ kParseErrorObjectMissName
Missing a name for object member.
@ kParseErrorNumberTooBig
Number too big to be stored in double.
@ kParseErrorStringUnicodeEscapeInvalidHex
Incorrect hex digit after \u escape in string.
@ kPointerParseErrorInvalidEscape
Invalid escape.
@ kPointerParseErrorTokenMustBeginWithSolidus
A token must begin with a '/'.
@ kPointerParseErrorNone
The parse is successful.
@ kPointerParseErrorCharacterMustPercentEncode
A character must percent encoded in URI fragment.
@ kPointerParseErrorInvalidPercentEncoding
Invalid percent encoding in URI fragment.
common definitions and configuration
Result of parsing (wraps ParseErrorCode)
ParseErrorCode Code() const
Get the error code.
ParseResult(ParseErrorCode code, size_t offset)
Constructor to set an error.
void Clear()
Reset error code.
bool(ParseResult::* BooleanType)() const
! Unspecified boolean type
void Set(ParseErrorCode code, size_t offset=0)
Update error code and offset.
ParseResult()
Default constructor, no error.
bool IsError() const
Whether the result is an error.
size_t Offset() const
Get the error offset, if IsError(), 0 otherwise.