Path: blob/main/devices/src/usb/backend/fido_backend/error.rs
5394 views
// Copyright 2024 The ChromiumOS Authors1// Use of this source code is governed by a BSD-style license that can be2// found in the LICENSE file.34use std::io::Error as IOError;56use remain::sorted;7use thiserror::Error;89use crate::utils::Error as UtilsError;1011#[sorted]12#[derive(Error, Debug)]13pub enum Error {14#[error("Failed to arm {name} timer: {error:#}")]15CannotArmPollTimer { name: String, error: base::Error },16#[error("Failed to clear {name} timer: {error:#}")]17CannotClearPollTimer { name: String, error: base::Error },18#[error("Cannot convert the u2f init packet from bytes")]19CannotConvertInitPacketFromBytes,20#[error("Cannot create the poll timer")]21CannotCreatePollTimer(base::Error),22#[error("Pending fido transfer reference has been lost.")]23FidoTransferLost,24#[error("The fido device is in an inconsistent state")]25InconsistentFidoDeviceState,26#[error("Invalid data buffer size")]27InvalidDataBufferSize,28#[error("The given hidraw device is not a security key")]29InvalidHidrawDevice,30#[error("The u2f init packet is invalid")]31InvalidInitPacket,32#[error("The u2f init packet contains invalid data size for the nonce")]33InvalidNonceSize,34#[error("Pending packet queue is full and cannot process more host packets")]35PendingInQueueFull,36#[error("Failed to read packet from hidraw device")]37ReadHidrawDevice(IOError),38#[error("Cannot start fido device queue")]39StartAsyncFidoQueue(UtilsError),40#[error("Unsupported TransferBuffer type")]41UnsupportedTransferBufferType,42#[error("Failed to wait context on poll thread")]43WaitContextFailed(anyhow::Error),44#[error("Failed to write to hidraw device")]45WriteHidrawDevice(IOError),46}4748pub type Result<T> = std::result::Result<T, Error>;495051