(result: Result<String, prqlc::ErrorMessages>)
| 124 | } |
| 125 | |
| 126 | fn return_or_throw(result: Result<String, prqlc::ErrorMessages>) -> Option<String> { |
| 127 | // When the `console_error_panic_hook` feature is enabled, we can call the |
| 128 | // `set_panic_hook` function at least once during initialization, and then |
| 129 | // we will get better error messages if our code ever panics. See |
| 130 | // `Cargo.toml` for notes. |
| 131 | #[cfg(feature = "console_error_panic_hook")] |
| 132 | console_error_panic_hook::set_once(); |
| 133 | |
| 134 | match result { |
| 135 | Ok(sql) => Some(sql), |
| 136 | Err(e) => wasm_bindgen::throw_str(&e.to_json()), |
| 137 | } |
| 138 | } |
no test coverage detected