diff --git a/cohort_banking_initiator_js/src/main.ts b/cohort_banking_initiator_js/src/main.ts index 5dcff4b8..b25b1fea 100644 --- a/cohort_banking_initiator_js/src/main.ts +++ b/cohort_banking_initiator_js/src/main.ts @@ -111,9 +111,11 @@ new Promise(async (resolve) => { queue, fnFinish, ) + try { await app.init() } catch (e) { + console.log(JSON.stringify(e, null, 2)) if (e instanceof TalosSdkError) { const sdkError = e as TalosSdkError if (sdkError.kind == SdkErrorKind.Messaging) { diff --git a/cohort_sdk_client/src/internal.ts b/cohort_sdk_client/src/internal.ts index edbaa4d2..817377b0 100644 --- a/cohort_sdk_client/src/internal.ts +++ b/cohort_sdk_client/src/internal.ts @@ -1,5 +1,5 @@ import { SDK_CONTAINER_TYPE } from "cohort_sdk_js" export const isSdkError = (reason: string): boolean => { - return (reason && reason.indexOf(`"typ":"${ SDK_CONTAINER_TYPE }"`) > 0 && reason.startsWith("{") && reason.endsWith("}")) + return (reason && reason.indexOf(`"_typ":"${ SDK_CONTAINER_TYPE }"`) > 0 && reason.startsWith("{") && reason.endsWith("}")) } diff --git a/packages/cohort_sdk_js/src/sdk_errors.rs b/packages/cohort_sdk_js/src/sdk_errors.rs index 8d79f3df..496af808 100644 --- a/packages/cohort_sdk_js/src/sdk_errors.rs +++ b/packages/cohort_sdk_js/src/sdk_errors.rs @@ -35,12 +35,9 @@ impl From for SdkErrorKind { } #[derive(Serialize)] +#[serde(rename_all = "camelCase", tag = "_typ")] #[napi] pub struct SdkErrorContainer { - /// Should always hold the name of this class. This attribute is used - /// by JS layer to recognise out container and safely parse it from JSON string - /// back to structured object. - pub typ: String, pub kind: SdkErrorKind, pub reason: String, pub cause: Option, @@ -55,12 +52,7 @@ pub const SDK_CONTAINER_TYPE: &str = "SdkErrorContainer"; #[napi] impl SdkErrorContainer { pub fn new(kind: SdkErrorKind, reason: String, cause: Option) -> Self { - Self { - typ: SDK_CONTAINER_TYPE.into(), - kind, - reason, - cause, - } + Self { kind, reason, cause } } pub fn json(&self) -> Value {