cargo_lambda_metadata/
error.rs1use std::{num::ParseIntError, path::PathBuf};
2
3use matchit::MergeError;
4use miette::Diagnostic;
5use thiserror::Error;
6
7#[derive(Debug, Diagnostic, Error)]
8pub enum MetadataError {
9 #[error("invalid memory value `{0}`")]
10 #[diagnostic()]
11 InvalidMemory(String),
12 #[error("invalid lambda metadata in Cargo.toml file: {0}")]
13 #[diagnostic()]
14 InvalidCargoMetadata(#[from] serde_json::Error),
15 #[error("invalid timeout value")]
16 #[diagnostic()]
17 InvalidTimeout(#[from] ParseIntError),
18 #[error("invalid tracing option `{0}`")]
19 #[diagnostic()]
20 InvalidTracing(String),
21 #[error(
22 "there are more than one binary in the project, please specify a binary name with --binary-name or --binary-path. This is the list of binaries I found: {0}"
23 )]
24 #[diagnostic()]
25 MultipleBinariesInProject(String),
26 #[error("there are no binaries in this project")]
27 #[diagnostic()]
28 MissingBinaryInProject,
29 #[error("invalid environment variable `{0}`")]
30 #[diagnostic()]
31 InvalidEnvVar(String),
32 #[error("invalid environment file `{0}`: {1}")]
33 #[diagnostic()]
34 InvalidEnvFile(PathBuf, std::io::Error),
35 #[error(transparent)]
36 #[diagnostic()]
37 FailedCmdExecution(#[from] cargo_metadata::Error),
38 #[error("invalid manifest file `{0}`: {1}")]
39 #[diagnostic()]
40 InvalidManifestFile(PathBuf, std::io::Error),
41 #[error(transparent)]
42 #[diagnostic()]
43 InvalidTomlManifest(toml::de::Error),
44 #[error(transparent)]
45 #[diagnostic()]
46 MergeError(#[from] MergeError),
47 #[error(transparent)]
48 #[diagnostic()]
49 ZigBuildError(#[from] anyhow::Error),
50}