[redland-dev] Patch: Log handler uses wrong user_data
Dave Beckett
dave.beckett at bristol.ac.uk
Thu Jul 8 21:49:45 BST 2004
On Thu, 08 Jul 2004 21:37:18 +0100
Edd Dumbill <edd at usefulinc.com> wrote:
> On Thu, 2004-07-08 at 22:20 +0200, René Puls wrote:
> > I also have a question regarding this log handler... If I'm using
> > Redland from a language like Objective-C, is it safe to throw an
> > exception inside the handler? This would interrupt normal execution,
> > so any Redland-internal code that follows the librdf_log_simple()
> > call would never be reached.
>
> I was just talking about this with Dave now, as I'm studying how to
> get error reporting into the C# API. The basic answer is "no". You
> simply have to store up the exceptions you get and then process them
> at the end of the call to the Redland function.
We were discussing alternatives and they include:
1. Changing every API call to add an error-return argument
(well every one that can use I/O, that's most model, storage,
parser, serializer, query calls. Most things can fail to allocate
memory also.)
librdf_error* error=NULL;
result=librdf_class_foo(obj, arg1, arg2, &error);
if(error) {
// do stuff
librdf_error_free(error);
}
Which is a huge change to the API.
2. Changing every class to store errors in a per-object slot.
result=librdf_class_foo(obj, arg1, arg2);
if(result failed) { /* NULL or -1 or something, it's in the docs */
librdf_error* error=librdf_class_get_error(obj);
// do stuff
librdf_error_free(error);
}
Which is a moderate change to the API but bloats every object
with a new pointer.
Of course there is also: Do nothing :)
Thoughts?
The log_simple stuff is in the CVS version, if it does seem a bad
idea, it would be best to do something before I freeze it in a
release.
Dave
More information about the redland-dev
mailing list