1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-31 10:24:23 +03:00
* 👷 prepare GitHub actions for new Docker image

* 👷 use experimental docker image

* 👷 use Clang-Analyzer 14

* 🔇 suppress readability-identifier-length

* 🔇 suppress more Clang-Tidy warnings

* ♻️ simplify code

* 🔇 suppress more Clang-Tidy warnings

* 🔇 suppress more Clang-Tidy warnings

* 🚨 fix warning

* 🚨 fix warning

* 🚨 fix warning

* 👷 use new Docker image
This commit is contained in:
Niels Lohmann
2021-10-29 21:27:34 +02:00
committed by GitHub
parent c4a4e672fd
commit 7440786b81
12 changed files with 98 additions and 151 deletions

View File

@ -60,7 +60,7 @@ class exception : public std::exception
protected:
JSON_HEDLEY_NON_NULL(3)
exception(int id_, const char* what_arg) : id(id_), m(what_arg) {}
exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} // NOLINT(bugprone-throw-keyword-missing)
static std::string name(const std::string& ename, int id_)
{
@ -198,7 +198,7 @@ class parse_error : public exception
{
std::string w = exception::name("parse_error", id_) + "parse error" +
position_string(pos) + ": " + exception::diagnostics(context) + what_arg;
return parse_error(id_, pos.chars_read_total, w.c_str());
return {id_, pos.chars_read_total, w.c_str()};
}
template<typename BasicJsonType>
@ -207,7 +207,7 @@ class parse_error : public exception
std::string w = exception::name("parse_error", id_) + "parse error" +
(byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") +
": " + exception::diagnostics(context) + what_arg;
return parse_error(id_, byte_, w.c_str());
return {id_, byte_, w.c_str()};
}
/*!
@ -276,7 +276,7 @@ class invalid_iterator : public exception
static invalid_iterator create(int id_, const std::string& what_arg, const BasicJsonType& context)
{
std::string w = exception::name("invalid_iterator", id_) + exception::diagnostics(context) + what_arg;
return invalid_iterator(id_, w.c_str());
return {id_, w.c_str()};
}
private:
@ -331,7 +331,7 @@ class type_error : public exception
static type_error create(int id_, const std::string& what_arg, const BasicJsonType& context)
{
std::string w = exception::name("type_error", id_) + exception::diagnostics(context) + what_arg;
return type_error(id_, w.c_str());
return {id_, w.c_str()};
}
private:
@ -379,7 +379,7 @@ class out_of_range : public exception
static out_of_range create(int id_, const std::string& what_arg, const BasicJsonType& context)
{
std::string w = exception::name("out_of_range", id_) + exception::diagnostics(context) + what_arg;
return out_of_range(id_, w.c_str());
return {id_, w.c_str()};
}
private:
@ -418,7 +418,7 @@ class other_error : public exception
static other_error create(int id_, const std::string& what_arg, const BasicJsonType& context)
{
std::string w = exception::name("other_error", id_) + exception::diagnostics(context) + what_arg;
return other_error(id_, w.c_str());
return {id_, w.c_str()};
}
private: