From 54bce0bcbc05bc0154a325ec3eb9998deee27761 Mon Sep 17 00:00:00 2001 From: timonson Date: Sun, 5 Nov 2023 15:55:31 +0100 Subject: [PATCH] Fix --- shadow.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shadow.js b/shadow.js index 4727e6b..6b5b860 100644 --- a/shadow.js +++ b/shadow.js @@ -304,17 +304,17 @@ export class Shadow extends HTMLElement { } else { throw new Error("The rpc result is not an object."); } - } catch (rpcError) { + } catch (error) { this.dispatchEvent( - new CustomEvent("rpcError", { + new CustomEvent("error", { bubbles: true, composed: true, - detail: { rpcError }, + detail: { error }, }), ); const errorMessage = - `Received rpc error code ${rpcError?.code} with the message: "${rpcError?.message}"${ - rpcError?.data ? ":\n" + rpcError.data : "." + `Received rpc error code ${error?.code} with the message: "${error?.message}"${ + error?.data ? ":\n" + error.data : "." }`; throw new ShadowError(errorMessage); }