From: Jan P. <pa...@pi...> - 2005-04-04 21:27:57
|
Hi, thanks for your contribution to the discussion - I hope more & more people will join us. LibExif is small library although quite complex. I'd like to avoid blowing it up with complicated stacks or tables of error handlers. -- Jan >> Let's say we define EXIF_RESULT_OK, EXIF_RESULT_SOMEWHAT_OK and >> EXIF_RESULT_NOT_OK. What code should libexif return if it encounters >> an unknown tag or a wrong format on loading? > > I don't intend to suggest making things complex, but two options pop to > mind that would clarify this: > > (1) Error handlers. > > Make an exif_set_handler(int error, void (*handler)(int err, char > *msg)) or the like (my definition is just for example). Keep a table of > error handlers. Set the default handler for every error to be the > logging function currently in use. This makes EXIF_RESULT_SOMEWHAT_OK > disambiguous, because by that point a developer will know what has > happened, and it maintains compatibility with the current API, because > by default, everything is still logged with the log handler. > > (2) Error stack. > > Make a simple struct that defines an error condition, and return a > pointer to a stack of them. Yes, this means memory allocation, but it > leaves it up to the developer as to what to do with it. Then it's just = a > matter of exif_errstack_cleanup(errstack *). This, however, leaves the > current logging routines in an awkward limbo, where developers may > develop around the stack, forget logging, and then, sometime down the > road, someone will push for removing it from the API, because > developers can already log things based on the error stack. > > > I think that (1) is probably the best approach as (2) is horribly > ugly, but I'm just throwing ideas out there. Let me know if I'm > horribly off base. > > -- Mike "Dexter" Church > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users= . > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick > _______________________________________________ > Libexif-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libexif-devel |