Libtga has a very simple error handling. If something goes wrong, the library functions call the macro TGA_ERROR (see Macros)with an appropriate error code. This macro prints out a short message to STDERR (via internal function TGAStrError()), sets TGA::last and returns. In case the user has defined an error handler this handler is called before.
On success the library functions set TGA::last to TGA_OK. So the user has generally to means of checking the library status: return value of the function and TGA::last.