mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Add filename to the BadFile exception (#858)
The BadFile exception which is thrown when failing to open a file now contains the filename.
This commit is contained in:
@@ -30,9 +30,9 @@ Node Load(std::istream& input) {
|
||||
}
|
||||
|
||||
Node LoadFile(const std::string& filename) {
|
||||
std::ifstream fin(filename.c_str());
|
||||
std::ifstream fin(filename);
|
||||
if (!fin) {
|
||||
throw BadFile();
|
||||
throw BadFile(filename);
|
||||
}
|
||||
return Load(fin);
|
||||
}
|
||||
@@ -63,9 +63,9 @@ std::vector<Node> LoadAll(std::istream& input) {
|
||||
}
|
||||
|
||||
std::vector<Node> LoadAllFromFile(const std::string& filename) {
|
||||
std::ifstream fin(filename.c_str());
|
||||
std::ifstream fin(filename);
|
||||
if (!fin) {
|
||||
throw BadFile();
|
||||
throw BadFile(filename);
|
||||
}
|
||||
return LoadAll(fin);
|
||||
}
|
||||
|
Reference in New Issue
Block a user