Commit fa9c3324 authored by Dmitry Yu. Naumov's avatar Dmitry Yu. Naumov Committed by Tom Fischer
Browse files

[BL] Extend error messages for xml patches.

parent 76a30506
...@@ -156,14 +156,17 @@ void patchStream(std::string patch_file, std::stringstream& prj_stream) ...@@ -156,14 +156,17 @@ void patchStream(std::string patch_file, std::stringstream& prj_stream)
{ {
OGS_FATAL( OGS_FATAL(
"Error while patching prj file with patch file {:}. Only " "Error while patching prj file with patch file {:}. Only "
"'add', 'replace' and 'remove' elements are allowed!", "'add', 'replace' and 'remove' elements are allowed! Got an "
patch_file); "element '{:s}' on line {:d}.",
patch_file, node->name, node->line);
} }
if (rc) if (rc)
{ {
OGS_FATAL("Error while patching prj file with patch file {:}.", OGS_FATAL(
patch_file); "Error while patching prj file with patch file {:}. Error in "
"element '{:s}' on line {:d}.",
patch_file, node->name, node->line);
} }
} }
...@@ -211,11 +214,18 @@ void readAndPatchPrj(std::stringstream& prj_stream, std::string& prj_file, ...@@ -211,11 +214,18 @@ void readAndPatchPrj(std::stringstream& prj_stream, std::string& prj_file,
} }
// read base prj file into stream // read base prj file into stream
std::ifstream file(prj_file); if (std::ifstream file(prj_file); file)
if (file)
{ {
prj_stream << file.rdbuf(); prj_stream << file.rdbuf();
file.close(); }
else
{
if (!BaseLib::IsFileExisting(prj_file))
{
ERR("File {:s} does not exist.", prj_file);
}
DBUG("Stream state flags: {:b}.", file.rdstate());
OGS_FATAL("Could not open project file '{:s}' for reading.", prj_file);
} }
// apply xml patches to stream // apply xml patches to stream
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment