fix: error handler
This commit is contained in:
parent
ded50dc62b
commit
631a1c054a
@ -157,15 +157,8 @@ export class TransactionProcessor extends BaseProcessor<Transaction> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleError(e) {
|
handleError({ message }: Error) {
|
||||||
// Sometimes ethers wraps known errors, unwrap it in this case
|
const error = CONTRACT_ERRORS.find((knownError) => message.includes(knownError));
|
||||||
if (e?.error?.error) {
|
|
||||||
e = e.error;
|
|
||||||
}
|
|
||||||
|
|
||||||
const message = e?.error ? e.error.message : e.message;
|
|
||||||
|
|
||||||
const error = CONTRACT_ERRORS.find((e) => (typeof e === 'string' ? e === message : message.match(e)));
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
throw new Error(`Revert by smart contract: ${error}`);
|
throw new Error(`Revert by smart contract: ${error}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user