'Convert an OpenSSL native context error failure into a Python
exception.
When a call to native OpenSSL X509_verify_cert fails, additonal information
about the failure can be obtained from the store context.'

def _exception_from_context(self):

    errors = [_lib.X509_STORE_CTX_get_error(self._store_ctx), _lib.X509_STORE_CTX_get_error_depth(self._store_ctx), _native(_ffi.string(_lib.X509_verify_cert_error_string(_lib.X509_STORE_CTX_get_error(self._store_ctx))))]
    _x509 = _lib.X509_STORE_CTX_get_current_cert(self._store_ctx)
    _cert = _lib.X509_dup(_x509)
    pycert = X509.__new__(X509)
    pycert._x509 = _ffi.gc(_cert, _lib.X509_free)
    return X509StoreContextError(errors, pycert)
