summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-09-05 13:00:31 +0200
committerljfa-ag <ljfa-ag@web.de>2015-09-05 13:00:31 +0200
commitfd32c7c7d05bc7e823d7e129d16193be4635b0c7 (patch)
tree2e35597b74189c0fbb67d213d9f68eb299fb1e37 /src
parent5c6cb9eca80a7bb18beb0fae42426b97a9f99fe0 (diff)
downloadProject-Tick-fd32c7c7d05bc7e823d7e129d16193be4635b0c7.tar.gz
Project-Tick-fd32c7c7d05bc7e823d7e129d16193be4635b0c7.zip
Change some exception types thrown by tag_list
Diffstat (limited to 'src')
-rw-r--r--src/tag_list.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tag_list.cpp b/src/tag_list.cpp
index a1a708a6a6..039bd9b77a 100644
--- a/src/tag_list.cpp
+++ b/src/tag_list.cpp
@@ -48,7 +48,7 @@ tag_list::tag_list(std::initializer_list<value> init)
for(const value& val: init)
{
if(!val || val.get_type() != el_type_)
- throw std::bad_cast();
+ throw std::invalid_argument("The values are not all the same type");
}
tags.assign(init.begin(), init.end());
}
@@ -67,18 +67,18 @@ const value& tag_list::at(size_t i) const
void tag_list::set(size_t i, value&& val)
{
if(val.get_type() != el_type_)
- throw std::bad_cast();
+ throw std::invalid_argument("The tag type does not match the list's content type");
tags.at(i) = std::move(val);
}
void tag_list::push_back(value_initializer&& val)
{
if(!val) //don't allow null values
- throw std::bad_cast();
+ throw std::invalid_argument("The value must not be null");
if(el_type_ == tag_type::Null) //set content type if undetermined
el_type_ = val.get_type();
else if(el_type_ != val.get_type())
- throw std::bad_cast();
+ throw std::invalid_argument("The tag type does not match the list's content type");
tags.push_back(std::move(val));
}
@@ -131,7 +131,7 @@ void tag_list::write_payload(io::stream_writer& writer) const
if(val.get_type() != el_type_)
{
writer.get_ostr().setstate(std::ios::failbit);
- throw std::bad_cast();
+ throw std::logic_error("The tags in the list do not all match the content type");
}
writer.write_payload(val);
}