mirror of
https://github.com/rzmk/czv.git
synced 2025-12-19 08:09:24 +00:00
refactor: improve error-handling, fix lints, & update criterion
This commit is contained in:
parent
f435642358
commit
c0b76fa543
6 changed files with 58 additions and 118 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue