backend error handling
Jussi Kukkonen
jhkukkon at cc.hut.fi
Wed Jul 11 14:11:43 PDT 2007
I'd like to implement some error handling for the position backends. I'm
pretty new to GError, so comments are welcome. I'm thinking different
backend types are different "error domains", and this is my view on how
it should look (using position backend/"error domain" as example):
geoclue_position_error.h:
> /* Error domain */
> #define GEOCLUE_POSITION_ERROR geoclue_position_error_quark ()
>
> GQuark geoclue_position_error_quark (void);
>
>
> /* Error codes */
> typedef enum {
> GEOCLUE_POSITION_ERROR_NOSERVICE, /* service was not available */
> GEOCLUE_POSITION_ERROR_FAILED /* non-specified fatal error */
> } GeocluePositionError;
>
geoclue_position_error.c (or in any suitable file):
> GQuark geoclue_position_error_quark() {
> static GQuark q = 0;
> if (q == 0)
> q = g_quark_from_static_string("geoclue-position-error-quark");
> return q;
> }
>
Usage example from hostip backend:
> g_set_error (error,
> GEOCLUE_POSITION_ERROR,
> GEOCLUE_POSITION_ERROR_NOSERVICE,
> "No data was received from %s.", HOSTIP_API);
>
-jussi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 307 bytes
Desc: OpenPGP digital signature
Url : http://lists.freedesktop.org/archives/geoclue/attachments/20070712/9c6e2b65/attachment-0001.pgp
More information about the GeoClue
mailing list