From 1c78950ac63364cbefa31c8c2c55abc79d5b99eb Mon Sep 17 00:00:00 2001 From: abefernan <44572727+abefernan@users.noreply.github.com> Date: Thu, 15 Jun 2023 14:23:29 +0200 Subject: [PATCH] Throw error when unknown typeUrl --- lib/txMsgHelpers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/txMsgHelpers.ts b/lib/txMsgHelpers.ts index 4cee151..8e776a7 100644 --- a/lib/txMsgHelpers.ts +++ b/lib/txMsgHelpers.ts @@ -39,7 +39,7 @@ export const exportMsgToJson = (msg: EncodeObject): EncodeObject => { return { ...msg, value: MsgCodecs[msg.typeUrl].toJSON(msg.value) }; } - return msg; + throw new Error("Unknown msg type"); }; const importMsgFromJson = (msg: EncodeObject): EncodeObject => { @@ -48,7 +48,7 @@ const importMsgFromJson = (msg: EncodeObject): EncodeObject => { return { ...msg, value: parsedValue }; } - return msg; + throw new Error("Unknown msg type"); }; export const dbTxFromJson = (txJson: string): DbTransaction | null => {