diff options
Diffstat (limited to 'common/rust/src/error.rs')
| -rw-r--r-- | common/rust/src/error.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/rust/src/error.rs b/common/rust/src/error.rs new file mode 100644 index 0000000..dcb7a54 --- /dev/null +++ b/common/rust/src/error.rs @@ -0,0 +1,18 @@ +use std::fmt; + +pub struct NovaError { + pub message: String, +} + +impl fmt::Display for NovaError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "An error occured wihind the nova system: {}", self.message) // user-facing output + } +} + +impl fmt::Debug for NovaError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{{ file: {}, line: {} }}", file!(), line!()) // programmer-facing output + } +} + |
