MCPcopy Create free account
hub / github.com/PRQL/prql / return_or_throw

Function return_or_throw

prqlc/bindings/js/src/lib.rs:126–138  ·  view source on GitHub ↗
(result: Result<String, prqlc::ErrorMessages>)

Source from the content-addressed store, hash-verified

124}
125
126fn 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}

Callers 5

compileFunction · 0.85
prql_to_plFunction · 0.85
pl_to_prqlFunction · 0.85
pl_to_rqFunction · 0.85
rq_to_sqlFunction · 0.85

Calls 1

to_jsonMethod · 0.80

Tested by

no test coverage detected