MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / ErrorMsg

Function ErrorMsg

include/sonic/error.h:57–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55};
56
57inline const char* ErrorMsg(SonicError error) noexcept {
58 struct SonicErrorInfo {
59 SonicError err;
60 const char* msg;
61 };
62 static const SonicErrorInfo kErrorMsg[kErrorNums] = {
63 {kErrorNone, "No errors"},
64 {kParseErrorEof, "Parse: JSON is empty or truncated."},
65 {kParseErrorInvalidChar, "Parse: JSON has invalid chars, e.g. 1.2x."},
66 {kParseErrorInfinity, "Parse: JSON number is infinity."},
67 {kParseErrorUnEscaped,
68 "Parse: JSON string has unescaped control chars (\\x00 ~ \\x1f)."},
69 {kParseErrorEscapedFormat,
70 "Parse: JSON string has wrong escaped format, e.g.\"\\g\""},
71 {kParseErrorEscapedUnicode,
72 "Parse: JSON string has wrong escaped unicode, e.g. \"\\uD800\""},
73 {kParseErrorInvalidUTF8,
74 "Parse: JSON string has wrong escaped unicode, e.g. \"\\xff\\xff\""},
75 {kParseErrorUnknownObjKey,
76 "ParseOnDemand: Not found the target keys in object."},
77 {kParseErrorArrIndexOutOfRange,
78 "ParseOnDemand: the target array index out of range."},
79 {kParseErrorMismatchType,
80 "ParseOnDemand: the target type is not matched."},
81 {kSerErrorUnsupportedType, "Serialize: DOM has invalid node type."},
82 {kSerErrorInfinity, "Serialize: DOM has inifinity number node."},
83 {kSerErrorInvalidObjKey,
84 "Serialize: The type of object's key is not string."},
85 {kErrorNoMem, "Memory is not enough to allocate."},
86 {kParseErrorUnexpect, "Unexpected Errors"},
87 };
88 return kErrorMsg[error].msg;
89}
90
91struct ParseResult {
92 public:

Callers 3

mainFunction · 0.85
parse_jsonFunction · 0.85
TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68