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:
Sepehr
2026-02-21 23:21:34 +01:00
parent 4440132b0a
commit fa480ed303
55 changed files with 5987 additions and 31 deletions

View 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())
}