Corrected a display error when showing error context.
This commit is contained in:
parent
b52e9cf41b
commit
ad34a71646
2 changed files with 14 additions and 5 deletions
|
|
@ -133,8 +133,12 @@ int main(int argc, char * argv[], char * envp[])
|
|||
}
|
||||
catch (const std::exception& err) {
|
||||
std::cout.flush(); // first display anything that was pending
|
||||
std::cerr << error_context() << std::endl
|
||||
<< "Error: " << err.what() << std::endl;
|
||||
|
||||
string context = error_context();
|
||||
if (! context.empty())
|
||||
std::cerr << context << std::endl;
|
||||
|
||||
std::cerr << "Error: " << err.what() << std::endl;
|
||||
}
|
||||
catch (int _status) {
|
||||
status = _status; // used for a "quick" exit, and is used only
|
||||
|
|
|
|||
|
|
@ -208,9 +208,14 @@ void textual_parser_t::instance_t::parse()
|
|||
add_error_context("While parsing file "
|
||||
<< file_context(pathname, linenum - 1));
|
||||
|
||||
std::cerr << error_context() << std::endl
|
||||
<< current_context << std::endl
|
||||
<< "Error: " << err.what() << std::endl;
|
||||
string context = error_context();
|
||||
if (! context.empty())
|
||||
std::cerr << context << std::endl;
|
||||
|
||||
if (! current_context.empty())
|
||||
std::cerr << current_context << std::endl;
|
||||
|
||||
std::cerr << "Error: " << err.what() << std::endl;
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue