Module Ssl.Error

type t = private {
  1. library_number : int;
    (*

    Identifies the OpenSSL sub-library that generated this error. Library values are defined in https://github.com/openssl/openssl/blob/openssl-3.0.0/include/openssl/err.h.in#L72

    *)
  2. reason_code : int;
    (*

    The reason code is the information about what went wrong.

    *)
  3. lib : string option;
    (*

    The library name that generated the error.

    *)
  4. reason : string option;
    (*

    The reason string for the error message.

    *)
}

The error code returned by ERR_get_error() consists of a library number, function code and reason code.

Each sub-library of OpenSSL has a unique library number; function and reason codes are unique within each sub-library. Note that different libraries may use the same value to signal different functions and reasons.

val get_error : unit -> t

Retrieve the earliest error from the error queue then it removes the entry. Returns the code and library and reason strings

val peek_error : unit -> t

Retrieve the earliest error from the error queue without modifying it. Returns the code and library and reason strings

val peek_last_error : unit -> t

Retrieves the latest error code from the thread's error queue without modifying it. Returns the code and library and reason strings.