diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-03 00:45:14 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-03 00:45:14 -0400 |
commit | ad34a716467464718990c207a123456cd36f89af (patch) | |
tree | 4d0e24c7c2ec59ce37d10debe86308a33a3bfd7a /src | |
parent | b52e9cf41b79eaede3718f862dc614d2a58cef6b (diff) | |
download | fork-ledger-ad34a716467464718990c207a123456cd36f89af.tar.gz fork-ledger-ad34a716467464718990c207a123456cd36f89af.tar.bz2 fork-ledger-ad34a716467464718990c207a123456cd36f89af.zip |
Corrected a display error when showing error context.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cc | 8 | ||||
-rw-r--r-- | src/textual.cc | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/main.cc b/src/main.cc index 736893a4..9a1e903e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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 diff --git a/src/textual.cc b/src/textual.cc index 1be5d4d8..ccce02ea 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -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++; } } |