Clean up "generic" intro pod files.
[openssl.git] / doc / crypto / ERR_put_error.pod
1 =pod
2
3 =head1 NAME
4
5 ERR_put_error, ERR_add_error_data - record an error
6
7 =head1 SYNOPSIS
8
9  #include <openssl/err.h>
10
11  void ERR_put_error(int lib, int func, int reason, const char *file,
12          int line);
13
14  void ERR_add_error_data(int num, ...);
15
16 =head1 DESCRIPTION
17
18 ERR_put_error() adds an error code to the thread's error queue. It
19 signals that the error of reason code B<reason> occurred in function
20 B<func> of library B<lib>, in line number B<line> of B<file>.
21 This function is usually called by a macro.
22
23 ERR_add_error_data() associates the concatenation of its B<num> string
24 arguments with the error code added last.
25
26 L<ERR_load_strings(3)> can be used to register
27 error strings so that the application can a generate human-readable
28 error messages for the error code.
29
30 =head2 Reporting errors
31
32 Each sub-library has a specific macro XXXerr() that is used to report
33 errors. Its first argument is a function code B<XXX_F_...>, the second
34 argument is a reason code B<XXX_R_...>. Function codes are derived
35 from the function names; reason codes consist of textual error
36 descriptions. For example, the function ssl3_read_bytes() reports a
37 "handshake failure" as follows:
38
39  SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE);
40
41 Function and reason codes should consist of upper case characters,
42 numbers and underscores only. The error file generation script translates
43 function codes into function names by looking in the header files
44 for an appropriate function name, if none is found it just uses
45 the capitalized form such as "SSL3_READ_BYTES" in the above example.
46
47 The trailing section of a reason code (after the "_R_") is translated
48 into lower case and underscores changed to spaces.
49
50 When you are using new function or reason codes, run B<make errors>.
51 The necessary B<#define>s will then automatically be added to the
52 sub-library's header file.
53
54 Although a library will normally report errors using its own specific
55 XXXerr macro, another library's macro can be used. This is normally
56 only done when a library wants to include ASN1 code which must use
57 the ASN1err() macro.
58
59
60 =head1 RETURN VALUES
61
62 ERR_put_error() and ERR_add_error_data() return
63 no values.
64
65 =head1 SEE ALSO
66
67 L<err(3)>, L<ERR_load_strings(3)>
68
69 =head1 COPYRIGHT
70
71 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
72
73 Licensed under the OpenSSL license (the "License").  You may not use
74 this file except in compliance with the License.  You can obtain a copy
75 in the file LICENSE in the source distribution or at
76 L<https://www.openssl.org/source/license.html>.
77
78 =cut