aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs
blob: ea259b391c7496c167ac6c9a7f3e9bc5220aa06d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use super::exception_interface::ExceptionInterface;
use super::invalid_argument_exception::InvalidArgumentException;

#[derive(Debug)]
pub struct CommandNotFoundException {
    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.inner)
    }
}

impl std::error::Error for CommandNotFoundException {}

impl ExceptionInterface for CommandNotFoundException {}