Skip to content

Commit

Permalink
Merge pull request #201 from jackielu3/master
Browse files Browse the repository at this point in the history
wallet error handling
  • Loading branch information
BraydenLangley authored Feb 11, 2025
2 parents a00dc29 + cd1aace commit 2aca0ff
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
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

0 comments on commit 2aca0ff

Please sign in to comment.