Skip to main content

tray_icon/
error.rs

1// Copyright 2022-2022 Tauri Programme within The Commons Conservancy
2// SPDX-License-Identifier: Apache-2.0
3// SPDX-License-Identifier: MIT
4
5use thiserror::Error;
6
7/// Errors returned by tray-icon.
8#[non_exhaustive]
9#[derive(Error, Debug)]
10pub enum Error {
11    #[error(transparent)]
12    OsError(#[from] std::io::Error),
13    #[cfg(any(
14        any(
15            target_os = "linux",
16            target_os = "dragonfly",
17            target_os = "freebsd",
18            target_os = "netbsd",
19            target_os = "openbsd"
20        ),
21        target_os = "macos"
22    ))]
23    #[error(transparent)]
24    PngEncodingError(#[from] png::EncodingError),
25    #[error("not on the main thread")]
26    NotMainThread,
27}
28
29/// Convenient type alias of Result type for tray-icon.
30pub type Result<T> = std::result::Result<T, Error>;