Better error message for YAML syntax errors (#7217)
Co-authored-by: Aleos <aleos89@users.noreply.github.com>
This commit is contained in:
parent
7c3bb6124a
commit
329158ac93
@ -106,7 +106,16 @@ bool YamlDatabase::load(const std::string& path) {
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
parser = {};
|
parser = {};
|
||||||
ryml::Tree tree = parser.parse_in_arena(c4::to_csubstr(path), c4::to_csubstr(buf));
|
ryml::Tree tree;
|
||||||
|
|
||||||
|
try{
|
||||||
|
tree = parser.parse_in_arena(c4::to_csubstr(path), c4::to_csubstr(buf));
|
||||||
|
}catch( const std::runtime_error& e ){
|
||||||
|
ShowError( "Failed to load %s database file from '" CL_WHITE "%s" CL_RESET "'.\n", this->type.c_str(), path.c_str() );
|
||||||
|
ShowError( "There is likely a syntax error in the file.\n" );
|
||||||
|
ShowError( "Error message: %s\n", e.what() );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Required here already for header error reporting
|
// Required here already for header error reporting
|
||||||
this->currentFile = path;
|
this->currentFile = path;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user