accesskit_atspi_common/
error.rs

1// Copyright 2022 The AccessKit Authors. All rights reserved.
2// Licensed under the Apache License, Version 2.0 (found in
3// the LICENSE-APACHE file) or the MIT license (found in
4// the LICENSE-MIT file), at your option.
5
6use std::fmt;
7
8#[derive(Debug)]
9pub enum Error {
10    Defunct,
11    UnsupportedInterface,
12    TooManyChildren,
13    IndexOutOfRange,
14    TooManyCharacters,
15    UnsupportedTextGranularity,
16}
17
18impl fmt::Display for Error {
19    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20        f.write_str(match self {
21            Self::Defunct => "defunct",
22            Self::UnsupportedInterface => "unsupported interface",
23            Self::TooManyChildren => "too many children",
24            Self::IndexOutOfRange => "index out of range",
25            Self::TooManyCharacters => "too many characters",
26            Self::UnsupportedTextGranularity => "unsupported text granularity",
27        })
28    }
29}
30
31impl std::error::Error for Error {}
32
33pub type Result<T> = std::result::Result<T, Error>;