1ERR_PUT_ERROR(3) OpenSSL ERR_PUT_ERROR(3)
2
3
4
6 ERR_put_error, ERR_add_error_data, ERR_add_error_vdata - record an
7 error
8
10 #include <openssl/err.h>
11
12 void ERR_put_error(int lib, int func, int reason, const char *file, int line);
13
14 void ERR_add_error_data(int num, ...);
15 void ERR_add_error_vdata(int num, va_list arg);
16
18 ERR_put_error() adds an error code to the thread's error queue. It
19 signals that the error of reason code reason occurred in function func
20 of library lib, in line number line of file. This function is usually
21 called by a macro.
22
23 ERR_add_error_data() associates the concatenation of its num string
24 arguments with the error code added last. ERR_add_error_vdata() is
25 similar except the argument is a va_list.
26
27 ERR_load_strings(3) can be used to register error strings so that the
28 application can a generate human-readable error messages for the error
29 code.
30
31 Reporting errors
32 Each sub-library has a specific macro XXXerr() that is used to report
33 errors. Its first argument is a function code XXX_F_..., the second
34 argument is a reason code XXX_R_.... Function codes are derived from
35 the function names; reason codes consist of textual error descriptions.
36 For example, the function ssl3_read_bytes() reports a "handshake
37 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 uppercase characters,
42 numbers and underscores only. The error file generation script
43 translates function codes into function names by looking in the header
44 files 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 lowercase and underscores changed to spaces.
49
50 Although a library will normally report errors using its own specific
51 XXXerr macro, another library's macro can be used. This is normally
52 only done when a library wants to include ASN1 code which must use the
53 ASN1err() macro.
54
56 ERR_put_error() and ERR_add_error_data() return no values.
57
59 ERR_load_strings(3)
60
62 Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
63
64 Licensed under the OpenSSL license (the "License"). You may not use
65 this file except in compliance with the License. You can obtain a copy
66 in the file LICENSE in the source distribution or at
67 <https://www.openssl.org/source/license.html>.
68
69
70
711.1.1q 2022-07-21 ERR_PUT_ERROR(3)