cargo_packager_resource_resolver/
error.rs

1// Copyright 2023-2023 CrabNebula Ltd.
2// SPDX-License-Identifier: Apache-2.0
3// SPDX-License-Identifier: MIT
4
5use std::path::PathBuf;
6
7/// The result type of `resource-resolver`.
8pub type Result<T> = std::result::Result<T, Error>;
9
10/// The error type of `resource-resolver`.
11#[derive(Debug, thiserror::Error)]
12#[non_exhaustive]
13pub enum Error {
14    #[error(transparent)]
15    Io(#[from] std::io::Error),
16    /// Unkown package format.
17    #[error("Unkown package format")]
18    UnkownPackageFormat,
19    /// Unsupported package format.
20    #[error("Unsupported package format")]
21    UnsupportedPackageFormat,
22    /// Couldn't find `APPDIR` environment variable.
23    #[error("Couldn't find `APPDIR` environment variable")]
24    AppDirNotFound,
25    /// `APPDIR` or `APPIMAGE` environment variable found but this application was not detected as an AppImage; this might be a security issue.
26    #[error("`APPDIR` or `APPIMAGE` environment variable found but this application was not detected as an AppImage; this might be a security issue.")]
27    InvalidAppImage,
28    /// Couldn't find parent of path.
29    #[error("Couldn't find parent of {0}")]
30    ParentNotFound(PathBuf),
31}