Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wallet error handling #201

Merged
merged 6 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.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)
Expand Down Expand Up @@ -82,6 +83,14 @@ All notable changes to this project will be documented in this file. The format

---

## [1.3.17] - 2025-02-11

### Fixed

- Added error handling to HTTPWalletJSON

---

## [1.3.15] - 2025-02-07

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 8 additions & 1 deletion src/wallet/substrates/HTTPWalletJSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,16 @@ export default class HTTPWalletJSON implements WalletInterface {
body: JSON.stringify(args)
})
).json()
if (!response.ok) {
const err = {
call,
args,
message: response.message || `HTTP Client error ${response.status}`
}
throw new Error(JSON.stringify(err))
}
return response
} catch (error) {
console.log({ HTTPWalletJSON: { call, args, error } })
throw error
}
}
Expand Down
Loading