[cairo] API: get error message
psychon at znc.in
Sat Nov 11 09:32:18 UTC 2017
On 11.11.2017 09:53, Adrian Johnson wrote:
> There a number of status types where cairo could report additional
> information on the error:
How would such an error message look like?
Looking at cairo-png.c, the extra info here would be the error message
provided by libpng, I guess? (png_simple_error_callback() in cairo-png.c)
This is a catch-all for most FT_Error values. Does freetype provide its
own error strings here or do you plan to invent your own descriptions?
(_ft_to_cairo_error() in cairo-ft-font.c)
_cairo_win32_print_gdi_error() currently (as the name implies) just
prints the error to stderr and then returns this error code. Do you want
to get rid of this print-to-stderr?
Also, the error messages here (specifically: the context argument to the
above function) seem quite internal to me, mentioning names of static
functions. What's the exact plan here?
This one seems to be purely cairo-internal, so the least of a problem.
> Currently the status just tells us something went wrong. With the above
> status types there could be multiple reasons why it might fail.
> I'd like to introduce a new function that can retrieve the reason for
> the failure.
> const char *
> Returns NULL if no error explanation available for the current status
> type (including SUCCESS). The returned string is owned by the surface
> and will be destroyed when the surface is destroyed.
Why only for surfaces? For example, the freetype errors likely end up
being on a font face and the win32 error will most likely be encountered
on a cairo context.
"Do you know that books smell like nutmeg or some spice from a foreign
-- Faber in Fahrenheit 451
More information about the cairo