mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 00:38:08 +08:00
improve error message for bad unwrap a bit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user