1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum LaunchError {
6 #[error("filesystem error at {path}: {source}")]
7 Filesystem {
8 path: PathBuf,
9 source: std::io::Error,
10 },
11 #[error("parse error in {path}: {message}")]
12 Parse { path: PathBuf, message: String },
13 #[error("configuration error: {message}")]
14 Config { message: String },
15}
16
17impl LaunchError {
18 pub fn parse(path: impl Into<PathBuf>, msg: impl Into<String>) -> Self {
19 Self::Parse {
20 path: path.into(),
21 message: msg.into(),
22 }
23 }
24
25 pub fn config(msg: impl Into<String>) -> Self {
26 Self::Config {
27 message: msg.into(),
28 }
29 }
30}