refactor: improve error-handling, fix lints, & update criterion

This commit is contained in:
rzmk 2024-06-20 23:18:38 -04:00
parent f435642358
commit c0b76fa543
No known key found for this signature in database
6 changed files with 58 additions and 118 deletions

View file

@ -44,19 +44,13 @@ use wasm_bindgen::JsValue;
// Error-handling helpers
#[derive(thiserror::Error, Debug)]
#[error("{0}")]
pub struct CzvError(anyhow::Error);
impl From<csv::Error> for CzvError {
fn from(value: csv::Error) -> Self {
value.into()
}
}
impl From<serde_wasm_bindgen::Error> for CzvError {
fn from(value: serde_wasm_bindgen::Error) -> Self {
value.into()
}
pub enum CzvError {
#[error("{0}")]
GeneralError(#[from] anyhow::Error),
#[error("{0}")]
CsvError(#[from] csv::Error),
#[error("{0}")]
SerdeWasmBindgenError(#[from] serde_wasm_bindgen::Error),
}
impl From<CzvError> for JsValue {