summaryrefslogtreecommitdiff
path: root/WebInterface/wasm/webhogg/src/webhogg_exception.rs
diff options
context:
space:
mode:
Diffstat (limited to 'WebInterface/wasm/webhogg/src/webhogg_exception.rs')
-rw-r--r--WebInterface/wasm/webhogg/src/webhogg_exception.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/WebInterface/wasm/webhogg/src/webhogg_exception.rs b/WebInterface/wasm/webhogg/src/webhogg_exception.rs
index eac67c7..46eedd6 100644
--- a/WebInterface/wasm/webhogg/src/webhogg_exception.rs
+++ b/WebInterface/wasm/webhogg/src/webhogg_exception.rs
@@ -2,11 +2,25 @@ use std::error::Error;
#[derive(Debug)]
pub enum WebhoggException {
+ DomError(String),
+ WebGlContextError(String),
+}
+
+impl WebhoggException {
+ fn err_name(&self) -> &str {
+ match self {
+ WebhoggException::DomError(_) => "DomError",
+ WebhoggException::WebGlContextError(_) => "WebGlContextError",
+ }
+ }
}
impl Error for WebhoggException {
fn description(&self) -> &str {
- "webhogg exception"
+ match self {
+ WebhoggException::DomError(desc) => desc,
+ WebhoggException::WebGlContextError(desc) => desc,
+ }
}
fn cause(&self) -> Option<&dyn Error> {
@@ -20,6 +34,6 @@ impl Error for WebhoggException {
impl std::fmt::Display for WebhoggException {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- write!(f, "WebhoggException: {}", self.description())
+ write!(f, "WebhoggException::{} {}", self.err_name(), self.description())
}
}