pub enum Error {
GlobalScopeNotFound,
CryptoUnreachable,
DomException(String, String),
Unknown,
}
Expand description
General errors that can occur when interacting with the Web Crypto API.
Variants§
GlobalScopeNotFound
Indicates that the global scope (window or worker context) could not be accessed. This might occur in environments where the Web API is not available.
CryptoUnreachable
Indicates that the Web Crypto API is not available in the current environment. This might occur in environments that don’t support the Web Crypto API or where it’s been disabled.
DomException(String, String)
Represents a DOM exception with a name and message. Provides more detailed information about Web API-specific errors.
§Fields
0
- The name of the DOM exception1
- The error message
Unknown
Represents an unknown or unexpected error that couldn’t be classified.
When the log-error
feature is enabled, these errors will be logged
to the console.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for DecryptionError
impl From<Error> for DecryptionError
Source§impl From<Error> for EncryptionError
impl From<Error> for EncryptionError
Source§impl From<Error> for ImportKeyError
impl From<Error> for ImportKeyError
Source§impl From<Error> for NonceError
impl From<Error> for NonceError
Source§impl From<JsValue> for Error
impl From<JsValue> for Error
Source§fn from(value: JsValue) -> Self
fn from(value: JsValue) -> Self
Converts a JavaScript value into a Rust Error.
If the JavaScript value is a DOMException, it will be converted into
a Error::DomException
with the appropriate name and message.
Otherwise, it will be converted into Error::Unknown
.
When the log-error
feature is enabled, unknown errors will be logged
to the console for debugging purposes.