Implement Error trait for KeyboardError using thiserror

This commit is contained in:
Sergey Smirnykh 2020-04-21 13:20:19 +07:00 committed by Victor Berger
parent 87acba51f8
commit a774d8c52e
1 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,7 @@ use std::{
rc::Rc, rc::Rc,
}; };
use tempfile::tempfile; use tempfile::tempfile;
use thiserror::Error;
use wayland_server::{ use wayland_server::{
protocol::{ protocol::{
wl_keyboard::{KeyState as WlKeyState, KeymapFormat, Request, WlKeyboard}, wl_keyboard::{KeyState as WlKeyState, KeymapFormat, Request, WlKeyboard},
@ -220,11 +221,13 @@ impl KbdInternal {
} }
/// Errors that can be encountered when creating a keyboard handler /// Errors that can be encountered when creating a keyboard handler
#[derive(Debug)] #[derive(Debug, Error)]
pub enum Error { pub enum Error {
/// libxkbcommon could not load the specified keymap /// libxkbcommon could not load the specified keymap
#[error("Libxkbcommon could not load the specified keymap")]
BadKeymap, BadKeymap,
/// Smithay could not create a tempfile to share the keymap with clients /// Smithay could not create a tempfile to share the keymap with clients
#[error("Failed to create tempfile to share the keymap: {0}")]
IoError(IoError), IoError(IoError),
} }