From 73100551c7a10235cfa768f0840ad4fdbf62876e Mon Sep 17 00:00:00 2001 From: Jackie Lu Date: Mon, 10 Feb 2025 10:59:42 -0800 Subject: [PATCH 1/6] wallet error handling --- src/wallet/substrates/HTTPWalletJSON.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wallet/substrates/HTTPWalletJSON.ts b/src/wallet/substrates/HTTPWalletJSON.ts index 6573c62..9e4a67c 100644 --- a/src/wallet/substrates/HTTPWalletJSON.ts +++ b/src/wallet/substrates/HTTPWalletJSON.ts @@ -64,6 +64,9 @@ export default class HTTPWalletJSON implements WalletInterface { body: JSON.stringify(args) }) ).json() + if (!response.ok) { + throw new Error(response.josn().message || `HTTP Client error ${response.status}`) + } return response } catch (error) { console.log({ HTTPWalletJSON: { call, args, error } }) From 397ed782e9e6057d4c2d057c6dd23f4c13cd9056 Mon Sep 17 00:00:00 2001 From: Jackie Lu Date: Mon, 10 Feb 2025 11:06:52 -0800 Subject: [PATCH 2/6] wallet error handling --- src/wallet/substrates/HTTPWalletJSON.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wallet/substrates/HTTPWalletJSON.ts b/src/wallet/substrates/HTTPWalletJSON.ts index 9e4a67c..9a1cd12 100644 --- a/src/wallet/substrates/HTTPWalletJSON.ts +++ b/src/wallet/substrates/HTTPWalletJSON.ts @@ -65,11 +65,10 @@ export default class HTTPWalletJSON implements WalletInterface { }) ).json() if (!response.ok) { - throw new Error(response.josn().message || `HTTP Client error ${response.status}`) + throw new Error(response.message || `HTTP Client error ${response.status}`) } return response } catch (error) { - console.log({ HTTPWalletJSON: { call, args, error } }) throw error } } From aac94cb4c1eb1a949741228820c5108d0d0b732e Mon Sep 17 00:00:00 2001 From: Jackie Lu Date: Tue, 11 Feb 2025 08:26:24 -0800 Subject: [PATCH 3/6] error handling v2 --- src/wallet/substrates/HTTPWalletJSON.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wallet/substrates/HTTPWalletJSON.ts b/src/wallet/substrates/HTTPWalletJSON.ts index 9a1cd12..02677b8 100644 --- a/src/wallet/substrates/HTTPWalletJSON.ts +++ b/src/wallet/substrates/HTTPWalletJSON.ts @@ -65,7 +65,12 @@ export default class HTTPWalletJSON implements WalletInterface { }) ).json() if (!response.ok) { - throw new Error(response.message || `HTTP Client error ${response.status}`) + const err = { + call, + args, + message: response.message || `HTTP Client error ${response.status}` + } + throw new Error(JSON.stringify(err)) } return response } catch (error) { From 7e4752c49a7052eea6c2855721bc0e7d085bb5ba Mon Sep 17 00:00:00 2001 From: Jackie Lu Date: Tue, 11 Feb 2025 08:31:28 -0800 Subject: [PATCH 4/6] changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc9acf..e260201 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. The format ## Table of Contents - [Unreleased](#unreleased) +- [1.3.16- 2025-02-11](#1316---2025-02-11) - [1.3.15- 2025-02-07](#1315---2025-02-07) - [1.3.14- 2025-02-07](#1314---2025-02-07) - [1.3.12 - 2025-01-29](#139---2025-01-29) @@ -82,6 +83,14 @@ All notable changes to this project will be documented in this file. The format --- +## [1.3.16] - 2025-02-11 + +### Fixed + +- Added error handling to HTTPWalletJSON + +--- + ## [1.3.15] - 2025-02-07 ### Fixed From 80e1d722e0f01c70eda9a59fd7ef48c38a574e5c Mon Sep 17 00:00:00 2001 From: Jackie Lu Date: Tue, 11 Feb 2025 08:33:00 -0800 Subject: [PATCH 5/6] 1.3.17 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4337884..5219d8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@bsv/sdk", - "version": "1.3.16", + "version": "1.3.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@bsv/sdk", - "version": "1.3.16", + "version": "1.3.17", "license": "SEE LICENSE IN LICENSE.txt", "devDependencies": { "@eslint/js": "^9.19.0", diff --git a/package.json b/package.json index d860c99..45905f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bsv/sdk", - "version": "1.3.16", + "version": "1.3.17", "type": "module", "description": "BSV Blockchain Software Development Kit", "main": "dist/cjs/mod.js", From cd1aace6cea93cfbda352f4b3da29289fbf24734 Mon Sep 17 00:00:00 2001 From: Jackie Lu Date: Tue, 11 Feb 2025 08:33:27 -0800 Subject: [PATCH 6/6] changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e260201..e550af0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format ## Table of Contents - [Unreleased](#unreleased) -- [1.3.16- 2025-02-11](#1316---2025-02-11) +- [1.3.17- 2025-02-11](#1316---2025-02-17) - [1.3.15- 2025-02-07](#1315---2025-02-07) - [1.3.14- 2025-02-07](#1314---2025-02-07) - [1.3.12 - 2025-01-29](#139---2025-01-29) @@ -83,7 +83,7 @@ All notable changes to this project will be documented in this file. The format --- -## [1.3.16] - 2025-02-11 +## [1.3.17] - 2025-02-11 ### Fixed