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

Avoid duplicate errors #105

Merged
merged 2 commits into from
Sep 8, 2021
Merged
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: 4 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class LedgerBridgeKeyring extends EventEmitter {
this.hdk.chainCode = Buffer.from(payload.chainCode, 'hex')
resolve(payload.address)
} else {
reject(new Error(payload.error || 'Unknown error'))
reject(payload.error || new Error('Unknown error'))
}
})
})
Expand Down Expand Up @@ -297,7 +297,7 @@ class LedgerBridgeKeyring extends EventEmitter {
reject(new Error('Ledger: The transaction signature is not valid'))
}
} else {
reject(new Error(payload.error || 'Ledger: Unknown error while signing transaction'))
reject(payload.error || new Error('Ledger: Unknown error while signing transaction'))
}
})
})
Expand Down Expand Up @@ -335,7 +335,7 @@ class LedgerBridgeKeyring extends EventEmitter {
}
resolve(signature)
} else {
reject(new Error(payload.error || 'Ledger: Unknown error while signing message'))
reject(payload.error || new Error('Ledger: Unknown error while signing message'))
}
})
})
Expand Down Expand Up @@ -403,8 +403,7 @@ class LedgerBridgeKeyring extends EventEmitter {
}
return signature
}
throw new Error(payload.error || 'Ledger: Unknown error while signing message')

throw payload.error || new Error('Ledger: Unknown error while signing message')
}

exportAccount () {
Expand Down