improve error message for bad unwrap a bit

This commit is contained in:
ToruNiina
2018-12-11 11:35:07 +09:00
parent 75c136924b
commit d75a977066

View File

@@ -370,7 +370,7 @@ struct result
{
if(is_err())
{
throw std::runtime_error("result: bad unwrap: " +
throw std::runtime_error("toml::result: bad unwrap: " +
format_error(this->as_err()));
}
return this->succ.value;
@@ -379,7 +379,7 @@ struct result
{
if(is_err())
{
throw std::runtime_error("result: bad unwrap: " +
throw std::runtime_error("toml::result: bad unwrap: " +
format_error(this->as_err()));
}
return this->succ.value;
@@ -388,7 +388,7 @@ struct result
{
if(is_err())
{
throw std::runtime_error("result: bad unwrap: " +
throw std::runtime_error("toml::result: bad unwrap: " +
format_error(this->as_err()));
}
return std::move(this->succ.value);
@@ -396,17 +396,17 @@ struct result
error_type& unwrap_err() &
{
if(is_ok()) {throw std::runtime_error("result: bad unwrap_err");}
if(is_ok()) {throw std::runtime_error("toml::result: bad unwrap_err");}
return this->fail.value;
}
error_type const& unwrap_err() const&
{
if(is_ok()) {throw std::runtime_error("result: bad unwrap_err");}
if(is_ok()) {throw std::runtime_error("toml::result: bad unwrap_err");}
return this->fail.value;
}
error_type&& unwrap_err() &&
{
if(is_ok()) {throw std::runtime_error("result: bad unwrap_err");}
if(is_ok()) {throw std::runtime_error("toml::result: bad unwrap_err");}
return std::move(this->fail.value);
}