All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
en.h
1 #ifndef RAPIDJSON_ERROR_EN_H__
2 #define RAPIDJSON_ERROR_EN_H__
3 
4 #include "error.h"
5 
6 namespace rapidjson {
7 
8 //! Maps error code of parsing into error message.
9 /*!
10  \param parseErrorCode Error code obtained in parsing.
11  \return the error message.
12  \note User can make a copy of this function for localization.
13  Using switch-case is safer for future modification of error codes.
14 */
15 inline const RAPIDJSON_ERROR_CHARTYPE* GetParseError_En(ParseErrorCode parseErrorCode) {
16  switch (parseErrorCode) {
17  case kParseErrorNone: return RAPIDJSON_ERROR_STRING("No error.");
18 
19  case kParseErrorDocumentEmpty: return RAPIDJSON_ERROR_STRING("The document is empty.");
20  case kParseErrorDocumentRootNotObjectOrArray: return RAPIDJSON_ERROR_STRING("The document root must be either object or array.");
21  case kParseErrorDocumentRootNotSingular: return RAPIDJSON_ERROR_STRING("The document root must not follow by other values.");
22 
23  case kParseErrorValueInvalid: return RAPIDJSON_ERROR_STRING("Invalid value.");
24 
25  case kParseErrorObjectMissName: return RAPIDJSON_ERROR_STRING("Missing a name for object member.");
26  case kParseErrorObjectMissColon: return RAPIDJSON_ERROR_STRING("Missing a colon after a name of object member.");
27  case kParseErrorObjectMissCommaOrCurlyBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or '}' after an object member.");
28 
29  case kParseErrorArrayMissCommaOrSquareBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or ']' after an array element.");
30 
31  case kParseErrorStringUnicodeEscapeInvalidHex: return RAPIDJSON_ERROR_STRING("Incorrect hex digit after \\u escape in string.");
32  case kParseErrorStringUnicodeSurrogateInvalid: return RAPIDJSON_ERROR_STRING("The surrogate pair in string is invalid.");
33  case kParseErrorStringEscapeInvalid: return RAPIDJSON_ERROR_STRING("Invalid escape character in string.");
34  case kParseErrorStringMissQuotationMark: return RAPIDJSON_ERROR_STRING("Missing a closing quotation mark in string.");
35  case kParseErrorStringInvalidEncoding: return RAPIDJSON_ERROR_STRING("Invalid encoding in string.");
36 
37  case kParseErrorNumberTooBig: return RAPIDJSON_ERROR_STRING("Number too big to be stored in double.");
38  case kParseErrorNumberMissFraction: return RAPIDJSON_ERROR_STRING("Miss fraction part in number.");
39  case kParseErrorNumberMissExponent: return RAPIDJSON_ERROR_STRING("Miss exponent in number.");
40 
41  case kParseErrorTermination: return RAPIDJSON_ERROR_STRING("Terminate parsing due to Handler error.");
42  case kParseErrorUnspecificSyntaxError: return RAPIDJSON_ERROR_STRING("Unspecific syntax error.");
43 
44  default:
45  return RAPIDJSON_ERROR_STRING("Unknown error.");
46  }
47 }
48 
49 } // namespace rapidjson
50 
51 #endif // RAPIDJSON_ERROR_EN_H__
The document root must not follow by other values.
Definition: error.h:41
No error.
Definition: error.h:37
Invalid value.
Definition: error.h:43
Miss fraction part in number.
Definition: error.h:58
The document is empty.
Definition: error.h:39
The surrogate pair in string is invalid.
Definition: error.h:52
Missing a colon after a name of object member.
Definition: error.h:46
Missing a closing quotation mark in string.
Definition: error.h:54
Invalid escape character in string.
Definition: error.h:53
Missing a name for object member.
Definition: error.h:45
Number too big to be stored in double.
Definition: error.h:57
const RAPIDJSON_ERROR_CHARTYPE * GetParseError_En(ParseErrorCode parseErrorCode)
Maps error code of parsing into error message.
Definition: en.h:15
Invalid encoding in string.
Definition: error.h:55
The document root must be either object or array.
Definition: error.h:40
Missing a comma or '}' after an object member.
Definition: error.h:47
ParseErrorCode
Error code of parsing.
Definition: error.h:36
Unspecific syntax error.
Definition: error.h:62
Parsing was terminated.
Definition: error.h:61
Incorrect hex digit after \u escape in string.
Definition: error.h:51
Miss exponent in number.
Definition: error.h:59
Missing a comma or ']' after an array element.
Definition: error.h:49