Gettext/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,xerror
andxerror2
, with the following function signatures.
- Function: void xerror (int
severity
, po_message_tmessage
, const char *filename
, size_tlineno
, size_tcolumn
, intmultiline_p
, const char *message_text
) This function is called to signal a problem of the given
severity
. It must not return ifseverity
isPO_SEVERITY_FATAL_ERROR
.message_text
is the problem description. Whenmultiline_p
is true, it can contain multiple lines of text, each terminated with a newline, otherwise a single line.message
and/orfilename
andlineno
indicate where the problem occurred:- If
filename
isNULL
,filename
andlineno
andcolumn
should be ignored. - If
lineno
is(size_t)(-1)
,lineno
andcolumn
should be ignored. - If
column
is(size_t)(-1)
, it should be ignored.
- If
- Function: void xerror2 (int
severity
, po_message_tmessage1
, const char *filename1
, size_tlineno1
, size_tcolumn1
, intmultiline_p1
, const char *message_text1
, po_message_tmessage2
, const char *filename2
, size_tlineno2
, size_tcolumn2
, intmultiline_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 ifseverity
isPO_SEVERITY_FATAL_ERROR
.It is similar to two calls to xerror. If possible, an ellipsis can be appended to
message_text1
and prepended tomessage_text2
.