[cairo] error handling questions

Vladimir Vukicevic vladimir at pobox.com
Mon Jun 18 13:52:15 PDT 2007


We've been using CAIRO_STATUS_NO_MEMORY as "unknown error" in a bunch of 
places; I know that it's generally been the policy to use a real error 
code, but would anyone mind if I were to introduce 
CAIRO_STATUS_UNKNOWN_ERROR (or CAIRO_STATUS_FAILURE) so that we can 
distinguish between real OOM and unknown errors?

Also, I'd like to add a bunch of #define's for the status messages that, 
for debug builds, do something like:

static cairo_status_t
_cairo_return_error(cairo_status_t status)
{
   return status;
}

#define CAIRO_STATUS_NO_MEMORY (_cairo_return_error(CAIRO_STATUS_NO_MEMORY))
etc.

to make it possible to set a breakpoint at the spot where the error is 
returned.  I'm not married to this approach, but right now it's hard to 
figure out where an error is getting signaled upstream, and this seemed 
like the easiest way to do it and avoid having to change a bunch of 
existing code ("return CAIRO_STATUS_FOO;").

Thoughts?
     - Vlad


More information about the cairo mailing list