Skip to content

Commit

Permalink
Lint fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ committed Jul 13, 2022
1 parent 59d57c3 commit c4e9616
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app/scripts/controllers/transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1456,17 +1456,23 @@ export default class TransactionController extends EventEmitter {
if (error.message.toLowerCase().includes('known transaction')) {
txHash = keccak(toBuffer(addHexPrefix(rawTx), 'hex')).toString('hex');
txHash = addHexPrefix(txHash);
} else if (error.message.includes("[ethjs-query] while formatting outputs from RPC")) {
} else if (
error.message.includes(
'[ethjs-query] while formatting outputs from RPC',
)
) {
// fix for ganache and hardhat users
// error ends up wrapped in a string & inside .value because of
// https://github.com/ethjs/ethjs-rpc/blob/master/src/index.js#L52
// https://github.com/ethjs/ethjs-query/blob/master/src/index.js#L78
let unwrapped;
try {
let errorJson = error.message.substring(
error.message.indexOf("{"),
error.message.indexOf(',"code"')
) + '}}}';
let errorJson = error.message
.substring(
error.message.indexOf('{'),
error.message.indexOf(',"code"'),
)
.concat('}}}');
errorJson = JSON.parse(errorJson);
unwrapped = new Error(errorJson.value.data.message);
unwrapped.code = errorJson.value.code;
Expand Down

0 comments on commit c4e9616

Please sign in to comment.