Skip to content

Commit 7326e19

Browse files
Merge pull request #375 from bsv-blockchain/walletErrorToJson
Wallet error to json
2 parents 5cb995c + a09bed4 commit 7326e19

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ All notable changes to this project will be documented in this file. The format
171171

172172
---
173173

174+
### [1.8.12] - 2025-11-06
175+
176+
### Fixed
177+
178+
- **WalletError**: unknownToJson now using isError and name rather than constructor.name
179+
180+
---
181+
174182
### [1.8.11] - 2025-10-30
175183

176184
### Fixed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bsv/sdk",
3-
"version": "1.8.11",
3+
"version": "1.8.12",
44
"type": "module",
55
"description": "BSV Blockchain Software Development Kit",
66
"main": "dist/cjs/mod.js",

src/wallet/WalletError.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export class WalletError extends Error {
2626
*/
2727
static unknownToJson (error: any): string {
2828
let e: any | undefined
29-
if (typeof error.constructor.name === 'string' && String(error.constructor.name).startsWith('WERR_')) {
29+
if (error.isError === true && String(error.name).startsWith('WERR_')) {
3030
e = {
31-
name: error.constructor.name,
31+
name: error.name,
3232
message: error.message,
3333
isError: true
3434
}

0 commit comments

Comments
 (0)