Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Tatarintsev committed Nov 23, 2023
1 parent 39b2489 commit b589b1f
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 24 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion query-engine/driver-adapters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ num-bigint = "0.4.3"
bigdecimal = "0.3.0"
chrono = "0.4.20"
futures = "0.3"
web-sys = "0.3.65"

[dev-dependencies]
expect-test = "1"
Expand Down
13 changes: 3 additions & 10 deletions query-engine/driver-adapters/src/wasm/async_js_function.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use js_sys::{Function as JsFunction, JsString, Promise as JsPromise};
use js_sys::{Function as JsFunction, Promise as JsPromise};
use serde::Serialize;
use std::marker::PhantomData;
use std::str::FromStr;
use wasm_bindgen::convert::FromWasmAbi;
use wasm_bindgen::describe::WasmDescribe;
use wasm_bindgen::{JsError, JsValue};
Expand Down Expand Up @@ -46,14 +45,8 @@ where
let result = self.call_internal(arg1).await;

match result {
Ok(js_result) => {
web_sys::console::log_1(&JsString::from_str("OK JS").unwrap().into());
js_result.into()
}
Err(err) => {
web_sys::console::log_1(&JsString::from_str("CALL ERR").unwrap().into());
Err(into_quaint_error(err))
}
Ok(js_result) => js_result.into(),
Err(err) => Err(into_quaint_error(err)),
}
}

Expand Down
1 change: 0 additions & 1 deletion query-engine/driver-adapters/src/wasm/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use wasm_bindgen::JsValue;
/// transforms a Wasm error into a Quaint error
pub(crate) fn into_quaint_error(wasm_err: JsValue) -> QuaintError {
let status = "WASM_ERROR".to_string();
web_sys::console::log_1(&wasm_err);
let reason = Reflect::get(&wasm_err, &JsValue::from_str("stack"))
.ok()
.and_then(|value| value.as_string())
Expand Down
6 changes: 1 addition & 5 deletions query-engine/driver-adapters/src/wasm/result.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::str::FromStr;

use js_sys::{Boolean as JsBoolean, JsString};
use js_sys::Boolean as JsBoolean;
use quaint::error::{Error as QuaintError, ErrorKind};
use wasm_bindgen::{JsCast, JsValue};

Expand Down Expand Up @@ -46,9 +44,7 @@ where

if ok {
let js_value: JsValue = object.get("value".into())?;
web_sys::console::log_1(&JsString::from_str("BEFORE DESERIALIZE").unwrap().into());
let deserialized = T::from_js_value(js_value)?;
web_sys::console::log_1(&JsString::from_str(" DESERIALIZE").unwrap().into());
return Ok(Self::Ok(deserialized));
}

Expand Down
7 changes: 1 addition & 6 deletions query-engine/driver-adapters/src/wasm/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use async_trait::async_trait;
use js_sys::{JsString, Object as JsObject};
use js_sys::Object as JsObject;
use metrics::decrement_gauge;
use quaint::{
connector::{IsolationLevel, Transaction as QuaintTransaction},
prelude::{Query as QuaintQuery, Queryable, ResultSet},
Value,
};
use std::str::FromStr;
use wasm_bindgen::JsCast;

use super::{
Expand Down Expand Up @@ -41,13 +40,9 @@ impl JsTransaction {
impl FromJsValue for JsTransaction {
fn from_js_value(value: wasm_bindgen::prelude::JsValue) -> Result<Self, wasm_bindgen::prelude::JsValue> {
let object: JsObjectExtern = value.dyn_into::<JsObject>()?.unchecked_into();
web_sys::console::log_1(&JsString::from_str("OBJECT").unwrap().into());
let common_proxy = CommonProxy::new(&object)?;
web_sys::console::log_1(&JsString::from_str("PROXY").unwrap().into());
let base = JsBaseQueryable::new(common_proxy);
web_sys::console::log_1(&JsString::from_str("BASE").unwrap().into());
let tx_proxy = TransactionProxy::new(&object)?;
web_sys::console::log_1(&JsString::from_str("TX_PROXY").unwrap().into());

Ok(Self::new(base, tx_proxy))
}
Expand Down

0 comments on commit b589b1f

Please sign in to comment.