pub struct ErrorHandler { /* private fields */ }Expand description
Accumulates WasmError values and provides diagnostic helpers.
Implementations§
Source§impl ErrorHandler
impl ErrorHandler
Sourcepub fn new(max_history: usize) -> Self
pub fn new(max_history: usize) -> Self
Create a new handler that keeps at most max_history errors.
Sourcepub fn handle(&mut self, error: WasmError) -> String
pub fn handle(&mut self, error: WasmError) -> String
Record error, store it in history (evicting oldest when full), and
return its JSON representation.
Sourcepub fn last_error(&self) -> Option<&WasmError>
pub fn last_error(&self) -> Option<&WasmError>
The most recently recorded error.
Sourcepub fn error_count(&self) -> usize
pub fn error_count(&self) -> usize
Total number of errors currently in history.
Sourcepub fn has_unrecoverable(&self) -> bool
pub fn has_unrecoverable(&self) -> bool
true if any error in history is unrecoverable.
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Remove all errors from history.
Sourcepub fn errors_by_code(&self, code: u32) -> Vec<&WasmError>
pub fn errors_by_code(&self, code: u32) -> Vec<&WasmError>
Errors matching the given numeric code.
Auto Trait Implementations§
impl Freeze for ErrorHandler
impl RefUnwindSafe for ErrorHandler
impl Send for ErrorHandler
impl Sync for ErrorHandler
impl Unpin for ErrorHandler
impl UnsafeUnpin for ErrorHandler
impl UnwindSafe for ErrorHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more