Next: , 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, xerror and xerror2, 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 if severity is PO_SEVERITY_FATAL_ERROR.

message_text is the problem description. When multiline_p is true, it can contain multiple lines of text, each terminated with a newline, otherwise a single line.

message and/or filename and lineno indicate where the problem occurred:

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 severity that refers to two messages. It must not return if severity is PO_SEVERITY_FATAL_ERROR.

It is similar to two calls to xerror. If possible, an ellipsis can be appended to message_text1 and prepended to message_text2.