aboutsummaryrefslogblamecommitdiffstats
path: root/liberror.7
blob: 964fe94c594b093da2ced80bd5de11cec7abae6b (plain) (tree)
1
                                  











































                                                           
                                   

                                                  
                          


                                               











                                                        





                                               












                            
                     

                            
                                 



                                

                                 
.TH LIBERROR 7 2020-06-09 liberror
.SH NAME
liberror \- single interface for custom and standard errors
.SH SYNOPSIS
.nf
#include <liberror.h>
.fi
.PP
Link with
.IR \-lerror .
.SH DESCRIPTION
The
.B liberror
library provides a single interface for error handling.
Specifically this is intended for cases where some
errors are
.I errno
errors or other
.B libc
errors and there are library-specific, maybe for
multiple libraries, errors.
.PP
The errors are thread-local, support error description,
error source string (which function failed), and error
code with error code group (e.g. \(dqerrno\(dq,
\(dqaddrinfo\(dq or a library name), as well as cause
chains, extended details, and if linked together with
.BR liberror-backtrace ,
backtraces.
.PP
The important functions are:
.TP
.BR liberror_get_error (3)
Get error for the calling thread.
.TP
.BR liberror_set_error (3)
Set error for the calling thread.
.TP
.BR liberror_set_error_errno (3)
Wrapper for the
.BR liberror_set_error (3)
function for
.I errno
errors.
.TP
.BR liberror_set_error_existing (3)
Set error for the calling thread to a saved error.
.TP
.BR liberror_pop_error (3)
Set error for the calling thread to the current
error's cause.
.TP
.BR liberror_reset_error (3)
Remove error for the calling thread, needed because the
.BR liberror_set_error (3)
function otherwise stores the error as the cause of the
new error.
.TP
.BR liberror_print_error (3)
Print the error for the calling thread, include its
backtrace if the
.B liberror-backtrace
library is also linked, the errors cause, and optionally
remove the error for the calling thread.
.TP
.BR liberror_start (3)
Shall be called when entering a signal handler.
.TP
.BR liberror_end (3)
Shall be called when a signal handler exits.
.SH EXAMPLES
None.
.SH APPLICATION USAGE
None.
.SH RATIONALE
None.
.SH FUTURE DIRECTIONS
None.
.SH NOTES
None.
.SH SEE ALSO
.BR liberror.h (0),
.BR liberror_copy_error (3),
.BR liberror_end (3),
.BR liberror_free_error (3),
.BR liberror_get_error (3),
.BR liberror_print_backtrace (3),
.BR liberror_print_error (3),
.BR liberror_reset_error (3),
.BR liberror_save_backtrace (3),
.BR liberror_set_error (3),
.BR liberror_set_error_errno (3),
.BR liberror_start (3)