rsenv/infrastructure/
error.rs1use thiserror::Error;
4
5use crate::application::ApplicationError;
6
7#[derive(Error, Debug)]
9pub enum InfraError {
10 #[error("{0}")]
11 Application(#[from] ApplicationError),
12
13 #[error("I/O error: {context}")]
14 Io {
15 context: String,
16 #[source]
17 source: std::io::Error,
18 },
19
20 #[error("sops command failed: {message}")]
21 Sops {
22 message: String,
23 exit_code: Option<i32>,
24 },
25
26 #[error("editor command failed: {message}")]
27 Editor { message: String },
28}
29
30impl InfraError {
31 pub fn io(context: impl Into<String>, source: std::io::Error) -> Self {
33 Self::Io {
34 context: context.into(),
35 source,
36 }
37 }
38}
39
40pub type InfraResult<T> = Result<T, InfraError>;