Skip to main content

Module errors

Module errors 

Source
Expand description

Error types for hashing and verification.

This module defines the structured error types used by hashing implementations and secret verification flows.

HashingError describes caller-visible hashing failures, and HashingOperation identifies which operation failed.

§Examples

Construct a hashing error with algorithm context:

use webgates_core::errors_core::UserFriendlyError;
use webgates_secrets::hashing::errors::{HashingError, HashingOperation};

let err = HashingError::with_algorithm(
    HashingOperation::Hash,
    "argon2 hashing failed",
    "argon2id",
);

assert!(err.user_message().contains("security processing system"));
assert!(err.developer_message().contains("Hash operation hash failed"));
assert!(err.support_code().starts_with("HASH-HASH"));

Construct a verification failure where retry is possible:

use webgates_core::errors_core::UserFriendlyError;
use webgates_secrets::hashing::errors::{HashingError, HashingOperation};

let err = HashingError::with_context(
    HashingOperation::Verify,
    "password verification failed",
    Some("argon2id".into()),
    Some("$argon2id$v=19$...".into()),
);
assert!(err.is_retryable());

Enums§

HashingError
Error returned by hashing services and verification flows.
HashingOperation
Hashing operation identifiers used for structured error reporting.