-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Build schema and connect sequentually 2. Print full stacktrace for WASM error 3. Expand example to attempt a query
- Loading branch information
Showing
4 changed files
with
65 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
use js_sys::Reflect; | ||
use quaint::error::Error as QuaintError; | ||
use wasm_bindgen::JsValue; | ||
|
||
type WasmError = JsValue; | ||
|
||
/// transforms a Wasm error into a Quaint error | ||
pub(crate) fn into_quaint_error(wasm_err: WasmError) -> QuaintError { | ||
pub(crate) fn into_quaint_error(wasm_err: JsValue) -> QuaintError { | ||
let status = "WASM_ERROR".to_string(); | ||
let reason = wasm_err.as_string().unwrap_or_else(|| "unknown error".to_string()); | ||
let reason = Reflect::get(&wasm_err, &JsValue::from_str("stack")) | ||
.ok() | ||
.and_then(|value| value.as_string()) | ||
.unwrap_or_else(|| "Unknown error".to_string()); | ||
QuaintError::raw_connector_error(status, reason) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters