Removed report_error() function and reordered context for parsing errors.
This commit is contained in:
parent
b18214372e
commit
cf9b4a3873
4 changed files with 7 additions and 10 deletions
|
|
@ -75,10 +75,4 @@ string line_context(const string& line,
|
|||
return buf.str();
|
||||
}
|
||||
|
||||
void report_error(const std::exception& err)
|
||||
{
|
||||
std::cerr << error_context() << std::endl
|
||||
<< "Error: " << err.what() << std::endl;
|
||||
}
|
||||
|
||||
} // namespace ledger
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ string line_context(const string& line,
|
|||
istream_pos_type pos = istream_pos_type(0),
|
||||
istream_pos_type end_pos = istream_pos_type(0));
|
||||
|
||||
void report_error(const std::exception& err);
|
||||
|
||||
#define DECLARE_EXCEPTION(name, kind) \
|
||||
class name : public kind { \
|
||||
public: \
|
||||
|
|
|
|||
|
|
@ -133,7 +133,8 @@ int main(int argc, char * argv[], char * envp[])
|
|||
}
|
||||
catch (const std::exception& err) {
|
||||
std::cout.flush();
|
||||
report_error(err);
|
||||
std::cerr << error_context() << std::endl
|
||||
<< "Error: " << err.what() << std::endl;
|
||||
}
|
||||
catch (int _status) {
|
||||
status = _status;
|
||||
|
|
|
|||
|
|
@ -190,6 +190,8 @@ void textual_parser_t::instance_t::parse()
|
|||
beg_line = linenum;
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
string current_context = error_context();
|
||||
|
||||
if (parent) {
|
||||
std::list<instance_t *> instances;
|
||||
|
||||
|
|
@ -206,7 +208,9 @@ void textual_parser_t::instance_t::parse()
|
|||
add_error_context("While parsing file "
|
||||
<< file_context(pathname, linenum - 1));
|
||||
|
||||
report_error(err);
|
||||
std::cerr << error_context() << std::endl
|
||||
<< current_context << std::endl
|
||||
<< "Error: " << err.what() << std::endl;
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue