GNU gettext utilities: Error Handling
Next: po_file_t API, Up: libgettextpo [Contents][Index]
9.13.1 Error Handling
Error management is performed through callbacks provided by the user of the library. They are provided through a parameter with the following type:
- Data Type
- struct po_xerror_handler
- Its pointer is defined as
po_xerror_handler_t. Contains two fields,xerrorandxerror2, with the following function signatures.
- Function: void xerror (int severity, po_message_t message, const char *filename, size_t lineno, size_t column, int multiline_p, const char *message_text)
This function is called to signal a problem of the given
severity. It must not return ifseverityisPO_SEVERITY_FATAL_ERROR.message_textis the problem description. Whenmultiline_pis true, it can contain multiple lines of text, each terminated with a newline, otherwise a single line.messageand/orfilenameandlinenoindicate where the problem occurred:- If
filenameisNULL,filenameandlinenoandcolumnshould be ignored. - If
linenois(size_t)(-1),linenoandcolumnshould be ignored. - If
columnis(size_t)(-1), it should be ignored.
- If
- Function: void xerror2 (int severity, po_message_t message1, const char *filename1, size_t lineno1, size_t column1, int multiline_p1, const char *message_text1, po_message_t message2, const char *filename2, size_t lineno2, size_t column2, int multiline_p2, const char *message_text2)
This function is called to signal a problem of the given
severitythat refers to two messages. It must not return ifseverityisPO_SEVERITY_FATAL_ERROR.It is similar to two calls to xerror. If possible, an ellipsis can be appended to
message_text1and prepended tomessage_text2.