error.rs
1 use thiserror::Error; 2 3 #[derive(Error, Debug)] 4 pub enum GramrError { 5 #[error("Not in a Foundry project. Please run this command from a Foundry project directory.")] 6 NotFoundryProject, 7 8 #[error("Foundry is not installed. Please install Foundry first: https://getfoundry.sh")] 9 FoundryNotInstalled, 10 11 #[error("Project not found: {0}")] 12 ProjectNotFound(String), 13 14 #[error("File already exists: {0}")] 15 FileExists(String), 16 17 #[error("Failed to create file: {0}")] 18 FileCreationError(String), 19 20 #[error("Failed to run forge command: {0}")] 21 ForgeCommandError(String), 22 23 #[error("Invalid contract name: {0}")] 24 InvalidContractName(String), 25 26 #[error("IO error: {0}")] 27 IoError(#[from] std::io::Error), 28 29 #[error("Other error: {0}")] 30 Other(String), 31 } 32 33 pub type Result<T> = std::result::Result<T, GramrError>;