quiver-dsp 0.1.0

A modular audio synthesis library using Arrow-style combinators and graph-based patching
Documentation
//! Error types for WASM bindings

use alloc::format;
use alloc::string::String;
use wasm_bindgen::prelude::*;

/// Error type for WASM bindings
#[wasm_bindgen]
pub struct QuiverError {
    message: String,
}

#[wasm_bindgen]
impl QuiverError {
    /// Get the error message
    #[wasm_bindgen(getter)]
    pub fn message(&self) -> String {
        self.message.clone()
    }
}

impl From<crate::graph::PatchError> for QuiverError {
    fn from(e: crate::graph::PatchError) -> Self {
        Self {
            message: format!("{:?}", e),
        }
    }
}

impl From<String> for QuiverError {
    fn from(message: String) -> Self {
        Self { message }
    }
}

impl From<&str> for QuiverError {
    fn from(message: &str) -> Self {
        Self {
            message: message.into(),
        }
    }
}