Function toError [src]

Prototype

pub fn toError(alert: AlertDescription) Error!void

Parameters

alert: AlertDescription

Possible Errors

TlsAlertAccessDenied
TlsAlertBadCertificate
TlsAlertBadCertificateStatusResponse
TlsAlertBadRecordMac
TlsAlertCertificateExpired
TlsAlertCertificateRequired
TlsAlertCertificateRevoked
TlsAlertCertificateUnknown
TlsAlertDecodeError
TlsAlertDecryptError
TlsAlertHandshakeFailure
TlsAlertIllegalParameter
TlsAlertInappropriateFallback
TlsAlertInsufficientSecurity
TlsAlertInternalError
TlsAlertMissingExtension
TlsAlertNoApplicationProtocol
TlsAlertProtocolVersion
TlsAlertRecordOverflow
TlsAlertUnexpectedMessage
TlsAlertUnknown
TlsAlertUnknownCa
TlsAlertUnknownPskIdentity
TlsAlertUnrecognizedName
TlsAlertUnsupportedCertificate
TlsAlertUnsupportedExtension

Source

pub fn toError(alert: AlertDescription) Error!void { switch (alert) { .close_notify => {}, // not an error .unexpected_message => return error.TlsAlertUnexpectedMessage, .bad_record_mac => return error.TlsAlertBadRecordMac, .record_overflow => return error.TlsAlertRecordOverflow, .handshake_failure => return error.TlsAlertHandshakeFailure, .bad_certificate => return error.TlsAlertBadCertificate, .unsupported_certificate => return error.TlsAlertUnsupportedCertificate, .certificate_revoked => return error.TlsAlertCertificateRevoked, .certificate_expired => return error.TlsAlertCertificateExpired, .certificate_unknown => return error.TlsAlertCertificateUnknown, .illegal_parameter => return error.TlsAlertIllegalParameter, .unknown_ca => return error.TlsAlertUnknownCa, .access_denied => return error.TlsAlertAccessDenied, .decode_error => return error.TlsAlertDecodeError, .decrypt_error => return error.TlsAlertDecryptError, .protocol_version => return error.TlsAlertProtocolVersion, .insufficient_security => return error.TlsAlertInsufficientSecurity, .internal_error => return error.TlsAlertInternalError, .inappropriate_fallback => return error.TlsAlertInappropriateFallback, .user_canceled => {}, // not an error .missing_extension => return error.TlsAlertMissingExtension, .unsupported_extension => return error.TlsAlertUnsupportedExtension, .unrecognized_name => return error.TlsAlertUnrecognizedName, .bad_certificate_status_response => return error.TlsAlertBadCertificateStatusResponse, .unknown_psk_identity => return error.TlsAlertUnknownPskIdentity, .certificate_required => return error.TlsAlertCertificateRequired, .no_application_protocol => return error.TlsAlertNoApplicationProtocol, _ => return error.TlsAlertUnknown, } }