Skip to content

Commit 8015949

Browse files
committed
error avoidance on lint in wallet-toolbox
Signed-off-by: Deggen <d.kellenschwiler@bsvassociation.org>
1 parent cf6b1d8 commit 8015949

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

packages/wallet/wallet-toolbox/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"test": "npm run build && jest --testPathIgnorePatterns=man.test.ts",
2929
"test:watch": "npm run build && jest --testPathIgnorePatterns=man.test.ts --watch",
3030
"test:coverage": "npm run build && jest --testPathIgnorePatterns=man.test.ts --coverage",
31-
"lint": "ts-standard --fix src/**/*.ts",
32-
"lint:ci": "ts-standard src/**/*.ts",
31+
"lint": "eslint --fix --no-error-on-unmatched-pattern \"src/**/*.ts\"",
32+
"lint:ci": "eslint --no-error-on-unmatched-pattern \"src/**/*.ts\"",
3333
"build": "tsc --build",
3434
"prepublish": "npm run lint && npm run build && npm run doc && npm run sync-versions",
3535
"doc": "ts2md",

packages/wallet/wallet-toolbox/src/sdk/WalletError.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,18 @@ export class WalletError extends Error implements WalletErrorObject {
6565
let stack: string | undefined
6666
const details: Record<string, string> = {}
6767
if (err !== null && typeof err === 'object') {
68-
if (err['name'] === 'Error' || err['name'] === 'FetchError') name = err['code'] || err['status'] || 'WERR_UNKNOWN'
69-
else name = err['name'] || err['code'] || err['status'] || 'WERR_UNKNOWN'
68+
const errObj = err as Record<string, unknown>
69+
if (errObj.name === 'Error' || errObj.name === 'FetchError') name = (errObj.code as string) || (errObj.status as string) || 'WERR_UNKNOWN'
70+
else name = (errObj.name as string) || (errObj.code as string) || (errObj.status as string) || 'WERR_UNKNOWN'
7071
if (typeof name !== 'string') name = 'WERR_UNKNOWN'
7172

72-
message = err['message'] || err['description'] || ''
73+
message = (errObj.message as string) || (errObj.description as string) || ''
7374
if (typeof message !== 'string') message = 'WERR_UNKNOWN'
7475

75-
if (typeof err['stack'] === 'string') stack = err['stack']
76+
if (typeof errObj.stack === 'string') stack = errObj.stack
7677

77-
if (typeof err['sql'] === 'string') details.sql = err['sql']
78-
if (typeof err['sqlMessage'] === 'string') details.sqlMessage = err['sqlMessage']
78+
if (typeof errObj.sql === 'string') details.sql = errObj.sql
79+
if (typeof errObj.sqlMessage === 'string') details.sqlMessage = errObj.sqlMessage
7980
}
8081
const e = new WalletError(name, message, stack, Object.keys(details).length > 0 ? details : undefined)
8182
if (err !== null && typeof err === 'object') {

0 commit comments

Comments
 (0)