Better handling of errors without line numbers.

[SVN r51406]
This commit is contained in:
Daniel James 2009-02-22 23:49:36 +00:00
parent 99442d62da
commit be4b655abc
4 changed files with 11 additions and 11 deletions

View File

@ -442,7 +442,7 @@ namespace quickbook
else
{
// fallback!
::quickbook::detail::outerr("",0)
::quickbook::detail::outerr("")
<< "Warning: Post Processing Failed."
<< std::endl;
out << in;
@ -453,8 +453,8 @@ namespace quickbook
catch(...)
{
// fallback!
::quickbook::detail::outerr("",0)
<< "Warning: Post Processing Failed."
::quickbook::detail::outerr("")
<< "Post Processing Failed."
<< std::endl;
out << in;
return 1;

View File

@ -104,7 +104,7 @@ namespace quickbook
actions actor(filein_, outdir, out);
bool r = parse(filein_, actor);
if (actor.section_level != 0)
detail::outwarn(filein_,1)
detail::outwarn(filein_)
<< "Warning missing [endsect] detected at end of file."
<< std::endl;
return r;
@ -270,21 +270,21 @@ main(int argc, char* argv[])
}
else
{
quickbook::detail::outerr("",0) << "Error: No filename given\n\n"
<< desc << std::endl;;
quickbook::detail::outerr("") << "Error: No filename given\n\n"
<< desc << std::endl;
return 1;
}
}
catch(std::exception& e)
{
quickbook::detail::outerr("",0) << "Error: " << e.what() << "\n";
quickbook::detail::outerr("") << "Error: " << e.what() << "\n";
return 1;
}
catch(...)
{
quickbook::detail::outerr("",0) << "Error: Exception of unknown type caught\n";
quickbook::detail::outerr("") << "Error: Exception of unknown type caught\n";
return 1;
}

View File

@ -212,7 +212,7 @@ namespace quickbook { namespace detail
if (!in)
{
outerr(filename,-1) << "Could not open input file." << endl;
outerr(filename) << "Could not open input file." << endl;
return 1;
}

4
detail/utils.hpp Executable file → Normal file
View File

@ -63,8 +63,8 @@ namespace quickbook { namespace detail
// common IDEs. Uses the ms_errors global to determine if VS format
// or GCC format. Returns the stream to continue ouput of the verbose
// error message.
std::ostream & outerr(std::string const& file, int line);
std::ostream & outwarn(std::string const& file, int line);
std::ostream & outerr(std::string const& file, int line = -1);
std::ostream & outwarn(std::string const& file, int line = -1);
// load file into memory with extra trailing newlines to eliminate
// the need to check for end of file in the grammar.