1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
.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)
|