Coding Guidelines/Error Handling

From wiki.zmanda.com
Jump to navigation Jump to search

The function error will print a debugging message to the relevant output stream, call a series of error handlers registered with onerror, and then terminate the process. It is used to handle totally unexpected errors in programs, e.g.,

error(_("writer: Syncpipe failure putting close"));

errordump is similar, but calls abort instead of exit, hopefully resulting in a core dump.

The related functions get_pname and set_pname manipulate the current process's notion of "my name," which does not necessarily correspond to the filename of the executing binary, but is used in various error messages.