revision: make EvalError impl Error (#2768)
This commit is contained in:
1 parent
f42ca65931
commit
0acfe37398
1 file changed
+15
@@ -3,6 +3,8 @@
|
||||
|
||||
use dioxus_core::prelude::*;
|
||||
use generational_box::GenerationalBox;
|
||||
use std::error::Error;
|
||||
use std::fmt::Display;
|
||||
use std::future::{poll_fn, Future, IntoFuture};
|
||||
use std::pin::Pin;
|
||||
use std::rc::Rc;
|
||||
@@ -117,3 +119,16 @@ pub enum EvalError {
|
||||
/// Represents an error communicating between JavaScript and Rust.
|
||||
Communication(String),
|
||||
}
|
||||
|
||||
impl Display for EvalError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
EvalError::Unsupported => write!(f, "EvalError::Unsupported - eval is not supported on the current platform"),
|
||||
EvalError::Finished => write!(f, "EvalError::Finished - eval has already ran"),
|
||||
EvalError::InvalidJs(_) => write!(f, "EvalError::InvalidJs - the provided javascript is invalid"),
|
||||
EvalError::Communication(_) => write!(f, "EvalError::Communication - there was an error trying to communicate with between javascript and rust"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for EvalError {}
|
||||
Reference in new issue
Block a user