33 const char *json_parser_exception::get_main_message()
37 case invalid_character_e:
38 return "invalid character";
39 case invalid_number_e:
40 return "invalid number format";
41 case number_out_of_range_e:
42 return "number out of range";
43 case number_too_long_e:
44 return "number too long";
45 case string_too_long_e:
46 return "string too long";
47 case unexpected_eof_e:
48 return "unexpected end of file";
49 case unexpected_token_e:
50 return "unexpected token";
57 json_parser_exception::json_parser_exception(
exception_type et,
size_t byte_index) noexcept:
59 m_byte_index(byte_index)
61 snprintf(m_message, max_message_length,
"parser exception, %s, at or near byte %lu", get_main_message(), m_byte_index);
64 json_parser_exception::json_parser_exception(
exception_type et,
char c,
size_t byte_index) noexcept:
66 m_byte_index(byte_index)
68 snprintf(m_message, max_message_length,
"parser exception, %s, at or near byte %lu : 0x%02x", get_main_message(), m_byte_index, c);
71 json_parser_exception::json_parser_exception(
exception_type et,
const string &s,
size_t byte_index) noexcept:
73 m_byte_index(byte_index)
75 snprintf(m_message, max_message_length,
"parser exception, %s, at or near byte %lu : %s", get_main_message(), m_byte_index, s.c_str());
78 json_parser_exception::json_parser_exception(
exception_type et,
size_t st,
size_t byte_index) noexcept:
80 m_byte_index(byte_index)
82 snprintf(m_message, max_message_length,
"parser exception, %s, at or near byte %lu : %ld", get_main_message(), m_byte_index, st);
85 size_t json_parser_exception::get_byte_index() const noexcept
The json_parser_exception class.
Base class for all exceptions thrown by the library.
#define NAMESPACE
You can change the namespace of the whole library by changing this value.
Common defs needed everywhere and, as far as is possible, platform specific changes.