Skip to main content

reinhardt_admin_cli/migrate_v2/
error.rs

1//! Errors produced by the Manouche v2 migration codemod.
2
3use std::path::PathBuf;
4
5use thiserror::Error;
6
7/// An error produced while validating or applying the migration codemod.
8#[derive(Debug, Error)]
9pub enum MigrateV2Error {
10	/// One or more requested skip rules are not supported.
11	#[error("unknown --skip rule(s): {0}")]
12	UnknownSkipRules(String),
13	/// The source tree could not be walked.
14	#[error("failed to walk source tree: {0}")]
15	Walk(#[from] walkdir::Error),
16	/// A source file could not be read or written.
17	#[error("I/O operation failed: {0}")]
18	Io(#[from] std::io::Error),
19	/// A file path does not have a parent directory for an atomic rewrite.
20	#[error("path has no parent directory: {}", .0.display())]
21	MissingParent(PathBuf),
22}
23
24/// Result type for the Manouche v2 migration codemod.
25pub type Result<T> = std::result::Result<T, MigrateV2Error>;