diff options
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs b/crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs index f1ed60b..ea259b3 100644 --- a/crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs +++ b/crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs @@ -1,13 +1,34 @@ +use super::exception_interface::ExceptionInterface; +use super::invalid_argument_exception::InvalidArgumentException; + #[derive(Debug)] pub struct CommandNotFoundException { - pub message: String, - pub code: i64, + inner: InvalidArgumentException, + alternatives: Vec<String>, +} + +impl CommandNotFoundException { + pub fn new(message: String, alternatives: Vec<String>, code: i64) -> Self { + Self { + inner: InvalidArgumentException(shirabe_php_shim::InvalidArgumentException { + message, + code, + }), + alternatives, + } + } + + pub fn get_alternatives(&self) -> &Vec<String> { + &self.alternatives + } } impl std::fmt::Display for CommandNotFoundException { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.message) + write!(f, "{}", self.inner) } } impl std::error::Error for CommandNotFoundException {} + +impl ExceptionInterface for CommandNotFoundException {} |
