2004.08.29 04:48 "Re: [Tiff] tif_fd and error handling", by Bob Friesenhahn
- I find the TIFFError and related completely useless. It is feeded no context whatsoever, neither a TIFF*, nor a tif_clientdata, nor a tif_fd. This may be fine in the typical Unix command-line tool that handles a single TIFF or set of TIFFs and knows what the errors are about and simply feeds them to the console and exits. But anything beyond that, from file browser to image editor or whatever, needs an indication of context together with the warning and error messages. I could either revert to Photoshop-style meaningfull messages, like 'The TIFF file cannot be opened because there was an error opening the TIFF file', or I could make my LibTiff modifications all over again and add that context to all TIFFError and TIFFWarning calls... I find neither option acceptable. I cannot understand why any of you is not bitten by this problem that was signalled as early as 1994 (http://www.asmail.be/msg0054815913.html). Is there something I am missing? How do you folks deal with this?
I agree with Erik Corry's (and Joris's) opinion. Any asynchronous error reporter should pass user supplied context.
However, not all hope is lost. Multithread environments normally provide the means to obtain the current thread ID. As long as the per-thread context is associated with the thread before libtiff is called, then the current thread ID may be used to retrieve it within the warning/error handler.