From b5c8a5bf6ab41dbb38438aaf36cea50200660f4b Mon Sep 17 00:00:00 2001 From: neeraj Date: Tue, 2 Apr 2024 16:46:17 +0530 Subject: [PATCH 1/2] Add context to error message --- src/index.ts | 5 +++-- src/messages/registry.ts | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 352fa40..1816ebd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -54,7 +54,7 @@ import { export const DEFAULT_CHAIN_ID = 'laconic_9000-1'; -const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd.'; +const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd'; // Parse Tx response from cosmos-sdk. export const parseTxResponse = (result: any, parseResponse?: (data: string) => any) => { @@ -117,7 +117,8 @@ export class Registry { console.error(error) } - return errorMessage || DEFAULT_WRITE_ERROR; + const [lastErrorLine] = error.split("\n").slice(-1); + return `${errorMessage || DEFAULT_WRITE_ERROR}: ${lastErrorLine}`; } constructor(gqlUrl: string, restUrl: string = "", chainId: string = DEFAULT_CHAIN_ID) { diff --git a/src/messages/registry.ts b/src/messages/registry.ts index 4e42a33..9ed3a3d 100644 --- a/src/messages/registry.ts +++ b/src/messages/registry.ts @@ -81,10 +81,10 @@ export const parseMsgSetRecordResponse = (data: string) => { } export const NAMESERVICE_ERRORS = [ - 'Name already reserved.', - 'Authority bond not found.', - 'Name authority not found.', - 'Access denied.', + 'Name already reserved', + 'Authority bond not found', + 'Name authority not found', + 'Access denied', ] export interface MessageMsgReserveAuthority { -- 2.45.2 From 53c436f7215a7b72a2ab4496519331753bf251a7 Mon Sep 17 00:00:00 2001 From: neeraj Date: Tue, 2 Apr 2024 17:26:26 +0530 Subject: [PATCH 2/2] Upgrade package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0397190..93d9d05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cerc-io/laconic-sdk", - "version": "0.1.15", + "version": "0.1.16", "main": "dist/index.js", "types": "dist/index.d.ts", "repository": "git@github.com:cerc-io/laconic-sdk.git", -- 2.45.2