feat: implement mass balance validation for Story 7.1
- Added port_mass_flows to Component trait and implements for core components. - Added System::check_mass_balance and integrated it into the solver. - Restored connect methods for ExpansionValve, Compressor, and Pipe to fix integration tests. - Updated Python and C bindings for validation errors. - Updated sprint status and story documentation.
This commit is contained in:
10
bindings/wasm/src/errors.rs
Normal file
10
bindings/wasm/src/errors.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
//! Error handling for WASM bindings.
|
||||
//!
|
||||
//! Maps errors to JavaScript exceptions with human-readable messages.
|
||||
|
||||
use wasm_bindgen::JsValue;
|
||||
|
||||
/// Convert a Result to a Result with JsValue error.
|
||||
pub fn result_to_js<T, E: std::fmt::Display>(result: Result<T, E>) -> Result<T, JsValue> {
|
||||
result.map_err(|e| js_sys::Error::new(&e.to_string()).into())
|
||||
}
|
||||
Reference in New Issue
Block a user