zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #15900
Re: [Merge] lp:~zorba-coders/zorba/zorba-error_printer_in_api into lp:zorba
> Anyway, Paul, can you help me on one thing please? Can you tell me how I can
> use this ErrorPrinter for warnings too?
An XQueryWarning is just a typedef for XQueryException, so it should just work as-is.
That aside: generally, I don't like to decide for the user how errors should be printed. By putting an error-printer in the public API, you're essentially making that decision for them. If you're going to do that, you could just define operator<<(ostream&,ZorbaException const&) and then << would just work.
If you want to set parameters (like XML or indentation), then the nice way to do it is via stream manipulators, e.g.:
// ...
}
catch ( XQueryException const &e ) {
cout << XQueryException::as_xml << XQueryException::indent( 2 ) << e;
}
You can look at src/util/indent.h for how to do this kind of thing. The above manipulators, however, should be "one-shot" and auto-reset (which is trivial to do).
--
https://code.launchpad.net/~zorba-coders/zorba/zorba-error_printer_in_api/+merge/134405
Your team Zorba Coders is subscribed to branch lp:zorba.
References