[cairo] cairomm exception handling questions
britten at caris.com
Mon Aug 11 05:56:11 PDT 2008
Just a couple of elementary exception handling questions, related
to cairomm. (I'm trying to get my groundwork laid correctly)
- After some trial-and-error (And grubbing through the cairomm
source code), I've discovered that passing an invalid file name
to PdfSurface::create() doesn't throw a Cairo::logic_error
exception, but instead, a std::ios_base::failure exception.
Wouldn't it make it more consistent to throw all cairomm
exceptions as Cairo::logic_error? Currently, I (as a programmer
trying to trap all Cairo exceptions and downgrading them to
errors) must add multiple 'catch' statements to all my 'try'
statements. That seems like it'll get repetitive/tedious pretty
- What am I expected to do with a Cairo::logic_error exception? I
had been planning to try use the ErrorStatus (cairo_status_t) to
return a meaningful error to the calling code. However, it seems
that I can't access the status (private, no 'get'). Thus, it
seems that all I can do is return a "Something went wrong in Cairo"
error, from every 'catch' that I write...
Thanks for any info, and sorry if I've missed something basic! I'm
just trying to make sure I get off on the right foot!
More information about the cairo