mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Pass a mark to BadSubscript exception (#843)
It's clearly related to an existing node, so it can have a mark and give an error location.
This commit is contained in:
@@ -248,8 +248,8 @@ class YAML_CPP_API BadDereference : public RepresentationException {
|
|||||||
class YAML_CPP_API BadSubscript : public RepresentationException {
|
class YAML_CPP_API BadSubscript : public RepresentationException {
|
||||||
public:
|
public:
|
||||||
template <typename Key>
|
template <typename Key>
|
||||||
BadSubscript(const Key& key)
|
BadSubscript(const Mark& mark_, const Key& key)
|
||||||
: RepresentationException(Mark::null_mark(),
|
: RepresentationException(mark_,
|
||||||
ErrorMsg::BAD_SUBSCRIPT_WITH_KEY(key)) {}
|
ErrorMsg::BAD_SUBSCRIPT_WITH_KEY(key)) {}
|
||||||
BadSubscript(const BadSubscript&) = default;
|
BadSubscript(const BadSubscript&) = default;
|
||||||
~BadSubscript() YAML_CPP_NOEXCEPT override;
|
~BadSubscript() YAML_CPP_NOEXCEPT override;
|
||||||
|
@@ -122,7 +122,7 @@ inline node* node_data::get(const Key& key,
|
|||||||
return pNode;
|
return pNode;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
case NodeType::Scalar:
|
case NodeType::Scalar:
|
||||||
throw BadSubscript(key);
|
throw BadSubscript(m_mark, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
|
for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
|
||||||
@@ -150,7 +150,7 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
|
|||||||
convert_to_map(pMemory);
|
convert_to_map(pMemory);
|
||||||
break;
|
break;
|
||||||
case NodeType::Scalar:
|
case NodeType::Scalar:
|
||||||
throw BadSubscript(key);
|
throw BadSubscript(m_mark, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
|
for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
|
||||||
|
@@ -196,7 +196,7 @@ void node_data::insert(node& key, node& value, shared_memory_holder pMemory) {
|
|||||||
convert_to_map(pMemory);
|
convert_to_map(pMemory);
|
||||||
break;
|
break;
|
||||||
case NodeType::Scalar:
|
case NodeType::Scalar:
|
||||||
throw BadSubscript(key);
|
throw BadSubscript(m_mark, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
insert_map_pair(key, value);
|
insert_map_pair(key, value);
|
||||||
@@ -226,7 +226,7 @@ node& node_data::get(node& key, shared_memory_holder pMemory) {
|
|||||||
convert_to_map(pMemory);
|
convert_to_map(pMemory);
|
||||||
break;
|
break;
|
||||||
case NodeType::Scalar:
|
case NodeType::Scalar:
|
||||||
throw BadSubscript(key);
|
throw BadSubscript(m_mark, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
|
for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
|
||||||
|
Reference in New Issue
Block a user