derec_library/primitives/verification/error.rs
1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 DeRec Alliance. All rights reserved.
3
4#[derive(Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum VerificationError {
7 #[error("verification response indicates a non-OK status (status={status}): {memo}")]
8 NonOkStatus { status: i32, memo: String },
9
10 /// The response's `(nonce, secret_id, version)` triple does not
11 /// match the request the owner had outstanding for this channel.
12 /// Surfaced when a stale/replayed response or one targeting a
13 /// different challenge reaches
14 /// [`crate::primitives::verification::response::process`].
15 #[error(
16 "verification response does not match the outstanding request: \
17 field={field} expected={expected} got={got}"
18 )]
19 ResponseBindingMismatch {
20 /// Which scalar disagreed — one of `"nonce"`, `"secret_id"`,
21 /// or `"version"`. Kept as a static string so the variant is
22 /// cheap to construct and easy to match on.
23 field: &'static str,
24 expected: u64,
25 got: u64,
26 },
27}