forge
ExploreLog in

Tahinli/forge

public
0 watching
★ 0
1.9 KiB
1//! Errors returned by [`crate::config::parse_config`].
2
3use thiserror::Error;
4
5/// Why a `.forge/ci.toml` file was rejected.
6#[derive(Debug, Clone, PartialEq, Eq, Error)]
7pub enum ConfigError {
8 #[error("ci config is {size} bytes, the limit is {max} bytes")]
9 TooLarge { size: usize, max: usize },
10
11 #[error("invalid TOML: {0}")]
12 Toml(String),
13
14 #[error("no jobs are defined")]
15 NoJobs,
16
17 #[error("{count} jobs are defined, the limit is {max}")]
18 TooManyJobs { count: usize, max: usize },
19
20 #[error("invalid job name {0:?}: must match ^[a-z0-9][a-z0-9_-]{{0,39}}$")]
21 InvalidJobName(String),
22
23 #[error("job {job:?} needs unknown job {need:?}")]
24 UnknownNeed { job: String, need: String },
25
26 #[error("jobs form a cycle, involving job {job:?}")]
27 Cycle { job: String },
28
29 #[error("job {job:?}: image must be non-empty and contain no whitespace")]
30 InvalidImage { job: String },
31
32 #[error("job {job:?}: run must not be empty")]
33 EmptyRun { job: String },
34
35 #[error("job {job:?}: invalid secret name {name:?}: must match ^[A-Z_][A-Z0-9_]{{0,63}}$")]
36 InvalidSecretName { job: String, name: String },
37
38 #[error("job {job:?}: invalid env name {name:?}: must match ^[A-Z_][A-Z0-9_]{{0,63}}$")]
39 InvalidEnvName { job: String, name: String },
40
41 #[error("job {job:?}: invalid artifact pattern {pattern:?}: {reason}")]
42 InvalidArtifactGlob {
43 job: String,
44 pattern: String,
45 reason: String,
46 },
47
48 #[error("job {job:?}: invalid runner label {label:?}")]
49 InvalidRunsOn { job: String, label: String },
50
51 #[error("job {job:?}: timeout_minutes must be between 1 and 360, got {value}")]
52 InvalidTimeout { job: String, value: u32 },
53
54 #[error("invalid {kind} glob {pattern:?}: {reason}")]
55 InvalidTriggerGlob {
56 kind: &'static str,
57 pattern: String,
58 reason: String,
59 },
60}