mirror of
https://github.com/nlohmann/json.git
synced 2026-07-21 19:23:03 +04:00
♻️ move diagnostic code in header
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <utility> // move
|
||||
|
||||
#include <nlohmann/detail/conversions/to_chars.hpp>
|
||||
#include <nlohmann/detail/diagnostics_t.hpp>
|
||||
#include <nlohmann/detail/exceptions.hpp>
|
||||
#include <nlohmann/detail/macro_scope.hpp>
|
||||
#include <nlohmann/detail/meta/cpp_future.hpp>
|
||||
@@ -499,7 +500,7 @@ class serializer
|
||||
{
|
||||
std::string sn(3, '\0');
|
||||
(std::snprintf)(&sn[0], sn.size(), "%.2X", byte);
|
||||
JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + sn));
|
||||
JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + sn, detail::diagnostics_t<BasicJsonType>()));
|
||||
}
|
||||
|
||||
case error_handler_t::ignore:
|
||||
@@ -593,7 +594,7 @@ class serializer
|
||||
{
|
||||
std::string sn(3, '\0');
|
||||
(std::snprintf)(&sn[0], sn.size(), "%.2X", static_cast<std::uint8_t>(s.back()));
|
||||
JSON_THROW(type_error::create(316, "incomplete UTF-8 string; last byte: 0x" + sn));
|
||||
JSON_THROW(type_error::create(316, "incomplete UTF-8 string; last byte: 0x" + sn, detail::diagnostics_t<BasicJsonType>()));
|
||||
}
|
||||
|
||||
case error_handler_t::ignore:
|
||||
|
||||
Reference in New Issue
Block a user