summaryrefslogtreecommitdiff
path: root/common/rust/src/error.rs
blob: 1a24657f8fcf2b60e7d6dfab374d853524603873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fmt;

#[derive(Debug)]
pub struct NovaError {
    pub message: String,
}

impl fmt::Display for NovaError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "An error occurred within the nova system: {}", self.message) // user-facing output
    }
}

impl From<&str> for NovaError {
    fn from(message: &str) -> Self {
        NovaError { message: message.to_string() }
    }
}