mirror of
https://github.com/nlohmann/json.git
synced 2026-10-28 08:45:43 +00:00
🚧 add diagnostics to exceptions
This commit is contained in:
5 files changed
+114
-86
No files matched your search
@@ -257,7 +257,7 @@ class iter_impl
|
||||
}
|
||||
|
||||
case value_t::null:
|
||||
JSON_THROW(invalid_iterator::create(214, "cannot get value"));
|
||||
JSON_THROW(invalid_iterator::create(214, m_object->diagnostics() + "cannot get value"));
|
||||
|
||||
default:
|
||||
{
|
||||
@@ -266,7 +266,7 @@ class iter_impl
|
||||
return *m_object;
|
||||
}
|
||||
|
||||
JSON_THROW(invalid_iterator::create(214, "cannot get value"));
|
||||
JSON_THROW(invalid_iterator::create(214, m_object->diagnostics() + "cannot get value"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,7 +300,7 @@ class iter_impl
|
||||
return m_object;
|
||||
}
|
||||
|
||||
JSON_THROW(invalid_iterator::create(214, "cannot get value"));
|
||||
JSON_THROW(invalid_iterator::create(214, m_object->diagnostics() + "cannot get value"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,7 +401,7 @@ class iter_impl
|
||||
// if objects are not the same, the comparison is undefined
|
||||
if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object))
|
||||
{
|
||||
JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers"));
|
||||
JSON_THROW(invalid_iterator::create(212, m_object->diagnostics() + "cannot compare iterators of different containers"));
|
||||
}
|
||||
|
||||
JSON_ASSERT(m_object != nullptr);
|
||||
@@ -438,7 +438,7 @@ class iter_impl
|
||||
// if objects are not the same, the comparison is undefined
|
||||
if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object))
|
||||
{
|
||||
JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers"));
|
||||
JSON_THROW(invalid_iterator::create(212, m_object->diagnostics() + "cannot compare iterators of different containers"));
|
||||
}
|
||||
|
||||
JSON_ASSERT(m_object != nullptr);
|
||||
@@ -446,7 +446,7 @@ class iter_impl
|
||||
switch (m_object->m_type)
|
||||
{
|
||||
case value_t::object:
|
||||
JSON_THROW(invalid_iterator::create(213, "cannot compare order of object iterators"));
|
||||
JSON_THROW(invalid_iterator::create(213, m_object->diagnostics() + "cannot compare order of object iterators"));
|
||||
|
||||
case value_t::array:
|
||||
return (m_it.array_iterator < other.m_it.array_iterator);
|
||||
@@ -494,7 +494,7 @@ class iter_impl
|
||||
switch (m_object->m_type)
|
||||
{
|
||||
case value_t::object:
|
||||
JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators"));
|
||||
JSON_THROW(invalid_iterator::create(209, m_object->diagnostics() + "cannot use offsets with object iterators"));
|
||||
|
||||
case value_t::array:
|
||||
{
|
||||
@@ -565,7 +565,7 @@ class iter_impl
|
||||
switch (m_object->m_type)
|
||||
{
|
||||
case value_t::object:
|
||||
JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators"));
|
||||
JSON_THROW(invalid_iterator::create(209, m_object->diagnostics() + "cannot use offsets with object iterators"));
|
||||
|
||||
case value_t::array:
|
||||
return m_it.array_iterator - other.m_it.array_iterator;
|
||||
@@ -586,13 +586,13 @@ class iter_impl
|
||||
switch (m_object->m_type)
|
||||
{
|
||||
case value_t::object:
|
||||
JSON_THROW(invalid_iterator::create(208, "cannot use operator[] for object iterators"));
|
||||
JSON_THROW(invalid_iterator::create(208, m_object->diagnostics() + "cannot use operator[] for object iterators"));
|
||||
|
||||
case value_t::array:
|
||||
return *std::next(m_it.array_iterator, n);
|
||||
|
||||
case value_t::null:
|
||||
JSON_THROW(invalid_iterator::create(214, "cannot get value"));
|
||||
JSON_THROW(invalid_iterator::create(214, m_object->diagnostics() + "cannot get value"));
|
||||
|
||||
default:
|
||||
{
|
||||
@@ -601,7 +601,7 @@ class iter_impl
|
||||
return *m_object;
|
||||
}
|
||||
|
||||
JSON_THROW(invalid_iterator::create(214, "cannot get value"));
|
||||
JSON_THROW(invalid_iterator::create(214, m_object->diagnostics() + "cannot get value"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -619,7 +619,7 @@ class iter_impl
|
||||
return m_it.object_iterator->first;
|
||||
}
|
||||
|
||||
JSON_THROW(invalid_iterator::create(207, "cannot use key() for non-object iterators"));
|
||||
JSON_THROW(invalid_iterator::create(207, m_object->diagnostics() + "cannot use key() for non-object iterators"));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in new issue
Block a user