scientific_workflow/execution/error.rs
1use std::path::PathBuf;
2
3use thiserror::Error;
4
5/// Failure while validating or creating an execution-directory scope.
6#[derive(Debug, Error)]
7#[non_exhaustive]
8pub enum ExecutionScopeError {
9 /// A caller-supplied scope name was empty or not one safe path component.
10 #[error("invalid execution scope name `{name}`")]
11 InvalidName {
12 /// Rejected scope name.
13 name: String,
14 },
15 /// The host UTC clock could not be formatted for the scope identity.
16 #[error("failed to format execution scope creation timestamp")]
17 Timestamp {
18 /// Timestamp-formatting failure.
19 #[source]
20 source: time::error::Format,
21 },
22 /// A filesystem operation failed at a scope boundary.
23 #[error("failed to {operation} execution scope at `{path}`")]
24 Io {
25 /// Stable filesystem action.
26 operation: &'static str,
27 /// Affected root or scope path.
28 path: PathBuf,
29 /// Underlying operating-system failure.
30 #[source]
31 source: std::io::Error,
32 },
33 /// Generated identity attempts repeatedly collided with existing scopes.
34 #[error("could not allocate a unique execution scope beneath `{root}`")]
35 IdentityExhausted {
36 /// Parent directory in which allocation was attempted.
37 root: PathBuf,
38 },
39}