Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion platforms/atspi-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ accesskit = { version = "0.21.1", path = "../../common" }
accesskit_consumer = { version = "0.31.0", path = "../../consumer" }
atspi-common = { version = "0.9", default-features = false }
serde = "1.0"
thiserror = "1.0"
zvariant = { version = "5.4", default-features = false }

25 changes: 18 additions & 7 deletions platforms/atspi-common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,31 @@
// the LICENSE-APACHE file) or the MIT license (found in
// the LICENSE-MIT file), at your option.

#[derive(Debug, thiserror::Error)]
use std::fmt;

#[derive(Debug)]
pub enum Error {
#[error("defunct")]
Defunct,
#[error("unsupported interface")]
UnsupportedInterface,
#[error("too many children")]
TooManyChildren,
#[error("index out of range")]
IndexOutOfRange,
#[error("too many characters")]
TooManyCharacters,
#[error("unsupported text granularity")]
UnsupportedTextGranularity,
}

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Self::Defunct => "defunct",
Self::UnsupportedInterface => "unsupported interface",
Self::TooManyChildren => "too many children",
Self::IndexOutOfRange => "index out of range",
Self::TooManyCharacters => "too many characters",
Self::UnsupportedTextGranularity => "unsupported text granularity",
})
}
}

impl std::error::Error for Error {}

pub type Result<T> = std::result::Result<T, Error>;