Re: Error handling
- From: Philip Van Hoof <spam pvanhoof be>
- To: Sergio Villar Senin <svillar igalia com>
- Cc: tinymail-devel-list gnome org
- Subject: Re: Error handling
- Date: Tue, 21 Nov 2006 19:43:04 +0100
On Tue, 2006-11-21 at 16:23 +0100, Sergio Villar Senin wrote:
> Philip Van Hoof wrote:
> > We have to do something about them .. errors.
>
> Sure.
>
> > I mostly simply ignore them (because my opinion is that too many people
> > develop with ONLY errors in mind, whereas errors should be handled in
> > the highest possible layer -- by displaying an error message -- in case
> > the code can't recover from an error by doing what is expected).
> >
> > For making it more simple for myself (prioritising things) I simply
> > printed some warnings whenever an error happens.
> >
> > I know right error handling requires adding a GError** parameter to
> > quite a lot methods. I'm not afraid if such an API change at this
> > moment.
>
> I agree with that, I don't think tinymail needs a more complicated error
> scheme. I can help with this (not a lot because I'm working in other
> stuff but it's still an aid).
>
> Maybe we can do something like:
>
> typedef enum _TnyError TnyError;
> enum _TnyError {
> TNY_ERROR_PERMISSION_DENIED,
> TNY_ERROR_CONNECTION_UNAVAILABLE,
> etc
> };
>
> GError *tny_error_new (TnyError error_number, const gchar *msg, ...);
>
> void tny_set_error(GError** err, TnyError error_number, const gchar*
> msg, ..);
>
> both with variable arguments. Each TnyError will have associated an
> error string (defined for example into the .c file). The GError will
> include both this string and the one set by the user.
>
> Just a proposal.
Sounds good. Can you work out the proposal on a wiki page? I'll add my
own ideas and remarks too of course.
I don't think we need to make this very complicated. GError style is
certainly good enough. We do have to make sure that we can language bind
this to a try { .. } catch (theerror) { .. } story on higher language
somehow (this usually isn't very difficult, but sometimes more difficult
to also automatically generate).
--
Philip Van Hoof, software developer
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
http://www.pvanhoof.be/blog
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]