Skip to content

Commit

Permalink
Avoid duplicate errors (MetaMask#105)
Browse files Browse the repository at this point in the history
* Avoid duplicate errors
  • Loading branch information
tmashuang authored Sep 8, 2021
1 parent 2b76044 commit fe695c8
Showing 1 changed file with 4 additions and 5 deletions.
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

0 comments on commit fe695c8

Please sign in to comment.