aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader/filesystem_exception.rs
blob: f0aa831fce9150465a8bb4964765a3242c1fe7f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! ref: composer/src/Composer/Downloader/FilesystemException.php

use shirabe_php_shim::Exception;

#[derive(Debug)]
pub struct FilesystemException(pub Exception);

impl FilesystemException {
    pub fn new(message: String, code: i64) -> Self {
        FilesystemException(Exception {
            message: format!("Filesystem exception: \n{}", message),
            code,
        })
    }
}

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

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