mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Switched exception constants to const char * const (from const std::string) so we don't have to construct them all in every translation unit, and switched the exception class to derive from std::runtime_error (so it handles what() for us)
This commit is contained in:
@@ -669,21 +669,21 @@ namespace Test
|
||||
try {
|
||||
doc["bad key"];
|
||||
} catch(const YAML::Exception& e) {
|
||||
if(e.msg != YAML::ErrorMsg::KEY_NOT_FOUND + ": bad key")
|
||||
if(e.msg != std::string(YAML::ErrorMsg::KEY_NOT_FOUND) + ": bad key")
|
||||
throw;
|
||||
}
|
||||
|
||||
try {
|
||||
doc[5];
|
||||
} catch(const YAML::Exception& e) {
|
||||
if(e.msg != YAML::ErrorMsg::KEY_NOT_FOUND + ": 5")
|
||||
if(e.msg != std::string(YAML::ErrorMsg::KEY_NOT_FOUND) + ": 5")
|
||||
throw;
|
||||
}
|
||||
|
||||
try {
|
||||
doc[2.5];
|
||||
} catch(const YAML::Exception& e) {
|
||||
if(e.msg != YAML::ErrorMsg::KEY_NOT_FOUND + ": 2.5")
|
||||
if(e.msg != std::string(YAML::ErrorMsg::KEY_NOT_FOUND) + ": 2.5")
|
||||
throw;
|
||||
}
|
||||
|
||||
|
@@ -888,7 +888,7 @@ namespace Test {
|
||||
YAML::Node doc;
|
||||
parser.GetNextDocument(doc);
|
||||
} catch(const YAML::ParserException& e) {
|
||||
YAML_ASSERT(e.msg == YAML::ErrorMsg::INVALID_ESCAPE + "c");
|
||||
YAML_ASSERT(e.msg == std::string(YAML::ErrorMsg::INVALID_ESCAPE) + "c");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user