Skip to content
Snippets Groups Projects
Verified Commit bacd47d0 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

fix: tentative fix for error and WASM

parent cbe67f49
No related branches found
No related tags found
No related merge requests found
Pipeline #3986 failed
use std::fmt::{self, Display, Formatter}; use std::fmt::{self, Display, Formatter};
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;
#[cfg(feature = "wasm")]
use wasm_bindgen::convert::*;
/// Top level enum for error handling. /// Top level enum for error handling.
/// Most of the time, you will want to use the `CustomError` variant /// Most of the time, you will want to use the `CustomError` variant
/// to provide a more detailed error message. /// to provide a more detailed error message.
#[derive(Debug)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum Error { pub enum Error {
NotFound, NotFound,
BadRequest, BadRequest,
...@@ -27,3 +33,13 @@ impl Display for Error { ...@@ -27,3 +33,13 @@ impl Display for Error {
write!(f, "{}", self.description()) write!(f, "{}", self.description())
} }
} }
#[cfg(feature = "wasm")]
impl IntoWasmAbi for Error {
type Abi = <Vec<u8> as IntoWasmAbi>::Abi;
#[inline]
fn into_abi(self) -> Self::Abi {
self.description().into_abi();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment