7 #include <nlohmann/detail/input/position_t.hpp>
8 #include <nlohmann/detail/macro_scope.hpp>
50 JSON_HEDLEY_RETURNS_NON_NULL
51 const char*
what() const noexcept
override
60 JSON_HEDLEY_NON_NULL(3)
61 exception(
int id_, const
char* what_arg) :
id(id_), m(what_arg) {}
63 static std::string name(
const std::string& ename,
int id_)
65 return "[json.exception." + ename +
"." + std::to_string(id_) +
"] ";
131 std::string w = exception::name(
"parse_error", id_) +
"parse error" +
132 position_string(pos) +
": " + what_arg;
136 static parse_error create(
int id_, std::size_t byte_,
const std::string& what_arg)
138 std::string w = exception::name(
"parse_error", id_) +
"parse error" +
139 (byte_ != 0 ? (
" at byte " + std::to_string(byte_)) :
"") +
156 parse_error(
int id_, std::size_t byte_,
const char* what_arg)
159 static std::string position_string(
const position_t& pos)
161 return " at line " + std::to_string(pos.
lines_read + 1) +
208 std::string w = exception::name(
"invalid_iterator", id_) + what_arg;
213 JSON_HEDLEY_NON_NULL(3)
260 static type_error create(
int id_,
const std::string& what_arg)
262 std::string w = exception::name(
"type_error", id_) + what_arg;
267 JSON_HEDLEY_NON_NULL(3)
307 static out_of_range create(
int id_,
const std::string& what_arg)
309 std::string w = exception::name(
"out_of_range", id_) + what_arg;
314 JSON_HEDLEY_NON_NULL(3)
345 static other_error create(
int id_,
const std::string& what_arg)
347 std::string w = exception::name(
"other_error", id_) + what_arg;
352 JSON_HEDLEY_NON_NULL(3)
exception indicating executing a member function with a wrong type
Definition: exceptions.hpp:258
general exception of the basic_json class
Definition: exceptions.hpp:47
struct to capture the start position of the current token
Definition: position_t.hpp:11
exception indicating access out of the defined range
Definition: exceptions.hpp:305
exception indicating errors with iterators
Definition: exceptions.hpp:204
std::size_t chars_read_current_line
the number of characters read in the current line
Definition: position_t.hpp:15
namespace for Niels Lohmann
Definition: adl_serializer.hpp:9
JSON_HEDLEY_RETURNS_NON_NULL const char * what() const noexcept override
returns the explanatory string
Definition: exceptions.hpp:51
exception indicating other library errors
Definition: exceptions.hpp:343
const std::size_t byte
byte index of the parse error
Definition: exceptions.hpp:153
exception indicating a parse error
Definition: exceptions.hpp:118
const int id
the id of the exception
Definition: exceptions.hpp:57
std::size_t lines_read
the number of lines read
Definition: position_t.hpp:17
static parse_error create(int id_, const position_t &pos, const std::string &what_arg)
create a parse error exception
Definition: exceptions.hpp:129
std::size_t chars_read_total
the total number of characters read
Definition: position_t.hpp:13