1 // Copyright 2018 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 use base::Error as SysError; 6 use remain::sorted; 7 use thiserror::Error; 8 9 #[sorted] 10 #[derive(Error, Debug)] 11 pub enum Error { 12 #[error("failed to create event: {0}")] 13 CreateEvent(SysError), 14 #[error("failed to create poll context: {0}")] 15 CreateWaitContext(SysError), 16 #[error("event loop already failed due to previous errors")] 17 EventLoopAlreadyFailed, 18 #[error("failed to read event: {0}")] 19 ReadEvent(SysError), 20 #[error("failed to start thread: {0}")] 21 StartThread(std::io::Error), 22 #[error("failed to add fd to poll context: {0}")] 23 WaitContextAddDescriptor(SysError), 24 #[error("failed to delete fd from poll context: {0}")] 25 WaitContextDeleteDescriptor(SysError), 26 #[error("failed to write event: {0}")] 27 WriteEvent(SysError), 28 } 29 30 pub type Result<T> = std::result::Result<T, Error>; 31