summaryrefslogtreecommitdiff
path: root/doc/tex/errors.tex
blob: 449c2c681041b1ea353035bb5389c5e06ee19e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
\section{Error Handling}
\par
In \gnutls most functions return an integer type as a result.
In almost all cases a zero or a positive number means success, and
a negative number indicates failure, or a situation that some
action has to be taken. Thus negative error codes may be fatal
or not. 
\par 
Fatal errors terminate the connection immediately and
further sends ard receives will be disallowed. An example of
a fatal error code is GNUTLS\_E\_MAC\_FAILED. Non-fatal errors
may warn about something (ie a warning alert was received), or
indicate the some action has to be taken. This is the case with
the error code GNUTLS\_E\_REHANDSHAKE returned by 
\hyperref{gnutls\_read()}{gnutls\_read() (see Section }{)}{gnutls_read}.
This error code requires a full handshake to be performed again, or an alert to be sent.
You can test if an error code is a fatal one by using the
\hyperref{gnutls\_error\_is\_fatal()}{gnutls\_error\_is\_fatal() (see Section }{)}{gnutls_error_is_fatal}.
\par
If any non fatal errors, that require reaction, are to be returned by a
function, these error codes will be documented
in the function's reference.