aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/invalid_repository_exception.rs
blob: e7aa850924817bfebb467a693e6bfb4fbf315ec9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//! ref: composer/src/Composer/Repository/InvalidRepositoryException.php

use shirabe_php_shim::Exception;

/// Exception thrown when a package repository is utterly broken
#[derive(Debug)]
pub struct InvalidRepositoryException(pub Exception);

impl InvalidRepositoryException {
    pub fn new(message: String) -> Self {
        Self(Exception { message, code: 0 })
    }
}

impl std::fmt::Display for InvalidRepositoryException {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        self.0.fmt(f)
    }
}

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