cargo_rapk/
error.rs

1use cargo_subcommand::Error as SubcommandError;
2use rndk::error::NdkError;
3use std::io::Error as IoError;
4use thiserror::Error;
5use toml::de::Error as TomlError;
6
7#[derive(Debug, Error)]
8pub enum Error {
9    #[error(transparent)]
10    Subcommand(#[from] SubcommandError),
11    #[error("Failed to parse config.")]
12    Config(#[from] TomlError),
13    #[error(transparent)]
14    Ndk(#[from] NdkError),
15    #[error(transparent)]
16    Io(#[from] IoError),
17    #[error("Configure a release keystore via `[package.metadata.android.signing.{0}]`")]
18    MissingReleaseKey(String),
19    #[error("`workspace=false` is unsupported")]
20    InheritedFalse,
21    #[error("`workspace=true` requires a workspace")]
22    InheritanceMissingWorkspace,
23    #[error("Failed to inherit field: `workspace.{0}` was not defined in workspace root manifest")]
24    WorkspaceMissingInheritedField(&'static str),
25}
26
27impl Error {
28    pub fn invalid_args() -> Self {
29        Self::Subcommand(SubcommandError::InvalidArgs)
30    }
31}