
#use wml::openssl-macros area=docs page=ERR_get_error

<title>Documents, ERR_get_error(3)</title>

<h1>ERR_get_error(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
	<LI><A HREF="#HISTORY">HISTORY</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
ERR_get_error, ERR_peek_error, ERR_peek_last_error, ERR_get_error_line,
ERR_peek_error_line, ERR_peek_last_error_line, ERR_get_error_line_data,
ERR_peek_error_line_data, ERR_peek_last_error_line_data - obtain error code
and data

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/err.h&gt;
</PRE>
<PRE> unsigned long ERR_get_error(void);
 unsigned long ERR_peek_error(void);
 unsigned long ERR_peek_last_error(void);
</PRE>
<PRE> unsigned long ERR_get_error_line(const char **file, int *line);
 unsigned long ERR_peek_error_line(const char **file, int *line);
 unsigned long ERR_peek_last_error_line(const char **file, int *line);
</PRE>
<PRE> unsigned long ERR_get_error_line_data(const char **file, int *line,
         const char **data, int *flags);
 unsigned long ERR_peek_error_line_data(const char **file, int *line,
         const char **data, int *flags);
 unsigned long ERR_peek_last_error_line_data(const char **file, int *line,
         const char **data, int *flags);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>ERR_get_error()</CODE> returns the earliest error code from the
thread's error queue and removes the entry. This function can be called
repeatedly until there are no more error codes to return.

</P>
<P>
<CODE>ERR_peek_error()</CODE> returns the earliest error code from the
thread's error queue without modifying it.

</P>
<P>
<CODE>ERR_peek_last_error()</CODE> returns the latest error code from the
thread's error queue without modifying it.

</P>
<P>
See <A HREF="../crypto/ERR_GET_LIB.html#">ERR_GET_LIB(3)</A> for obtaining information about location and reason of the error, and
<A HREF="../crypto/ERR_error_string.html#">ERR_error_string(3)</A> for human-readable error messages.

</P>
<P>
<CODE>ERR_get_error_line(),</CODE> <CODE>ERR_peek_error_line()</CODE> and
<CODE>ERR_peek_last_error_line()</CODE> are the same as the above, but they
additionally store the file name and line number where the error occurred
in *<STRONG>file</STRONG> and *<STRONG>line</STRONG>, unless these are <STRONG>NULL</STRONG>.

</P>
<P>
<CODE>ERR_get_error_line_data(),</CODE>
<CODE>ERR_peek_error_line_data()</CODE> and
<CODE>ERR_get_last_error_line_data()</CODE> store additional data and flags
associated with the error code in *<STRONG>data</STRONG>
and *<STRONG>flags</STRONG>, unless these are <STRONG>NULL</STRONG>. *<STRONG>data</STRONG> contains a string if *<STRONG>flags</STRONG>&amp;<STRONG>ERR_TXT_STRING</STRONG>. If it has been allocated by <CODE>OPENSSL_malloc(),</CODE> *<STRONG>flags</STRONG>&amp;<STRONG>ERR_TXT_MALLOCED</STRONG> is true.

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
The error code, or 0 if there is no error in the queue.

</P>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../crypto/err.html#">err(3)</A>, <A HREF="../crypto/ERR_error_string.html#">ERR_error_string(3)</A>,
<A HREF="../crypto/ERR_GET_LIB.html#">ERR_GET_LIB(3)</A>



</P>
<P>
<HR>
<H1><A NAME="HISTORY">HISTORY</A></H1>
<P>
<CODE>ERR_get_error(),</CODE> <CODE>ERR_peek_error(),</CODE>
<CODE>ERR_get_error_line()</CODE> and <CODE>ERR_peek_error_line()</CODE>
are available in all versions of SSLeay and OpenSSL.
<CODE>ERR_get_error_line_data()</CODE> and
<CODE>ERR_peek_error_line_data()</CODE> were added in SSLeay 0.9.0.
<CODE>ERR_peek_last_error(),</CODE> <CODE>ERR_peek_last_error_line()</CODE>
and <CODE>ERR_peek_last_error_line_data()</CODE> were added in OpenSSL
0.9.7.

</P>
:}

