1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use diagnostic::FileID;

use super::*;

impl From<Error> for VosError {
    fn from(error: Error) -> Self {
        Self { kind: Box::new(VosErrorKind::IOError(error)), level: DiagnosticLevel::Error, file: Default::default() }
    }
}

impl VosError {
    pub fn with_file(mut self, file: impl TryInto<FileID>) -> Self {
        match file.try_into() {
            Ok(o) => self.file = o,
            Err(_) => {}
        }
        self
    }
    pub fn set_file(&mut self, file: impl Into<FileID>) {
        self.file = file.into();
    }
}