From 853e171f9ecbf272c63a5a8d4be1e40555d84c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kotol?= Date: Tue, 8 Aug 2023 10:19:37 +0200 Subject: [PATCH] ALL-2054 - Add error log link (#867) --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/util/error.ts | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9414b4495..efe6695595 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [3.0.5] - 2023.08.07 +### Changed +- In all error responses expects for RPC, error object returns also `dashboardLog` which points to the dashboard error log + ## [3.0.4] - 2023.08.07 ### Changed - Added EVM debug_traceBlock and eth_getBlockReceipts methods diff --git a/package.json b/package.json index ff84ffbbd7..17026db6d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tatumio/tatum", - "version": "3.0.4", + "version": "3.0.5", "description": "Tatum JS SDK", "author": "Tatum", "repository": "https://github.com/tatumio/tatum-js", diff --git a/src/util/error.ts b/src/util/error.ts index 61680ed460..dfa957f057 100644 --- a/src/util/error.ts +++ b/src/util/error.ts @@ -21,6 +21,7 @@ export interface ResponseDto { type ErrorWithMessage = { message: string[] | object[] code?: string + dashboardLog?: string } export const ErrorUtils = { @@ -66,24 +67,29 @@ export const ErrorUtils = { return { message: (error.data as string[]).map((message) => ErrorUtils.formatErrorMsg(message)), code: error.errorCode, + dashboardLog: error.dashboardLog, } } return { message: [error.message ?? maybeError], code: error.errorCode, + dashboardLog: error.dashboardLog, } // eslint-disable-next-line no-empty } catch (_) {} } if (ErrorUtils.isErrorWithMessage(maybeError)) { - return { message: [maybeError.message] } + return { message: [maybeError.message], dashboardLog: maybeError.dashboardLog } } try { return { message: [JSON.stringify(maybeError, null, 2)], + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + dashboardLog: maybeError.dashboardLog, } } catch { // fallback in case there's an error stringifying the maybeError