diff --git a/packages/abi/src.ts/interface.ts b/packages/abi/src.ts/interface.ts index 3ef3a2cad1..4a2fb0b902 100644 --- a/packages/abi/src.ts/interface.ts +++ b/packages/abi/src.ts/interface.ts @@ -390,6 +390,7 @@ export class Interface { let bytes = arrayify(data); let reason: string = null; + let message = ""; let errorArgs: Result = null; let errorName: string = null; let errorSignature: string = null; @@ -408,6 +409,11 @@ export class Interface { errorName = builtin.name; errorSignature = builtin.signature; if (builtin.reason) { reason = errorArgs[0]; } + if (errorName === "Error") { + message = `; VM Exception while processing transaction: reverted with reason string ${ JSON.stringify(errorArgs[0]) }`; + } else if (errorName === "Panic") { + message = `; VM Exception while processing transaction: reverted with panic code ${ errorArgs[0] }`; + } } else { try { const error = this.getError(selector); @@ -420,9 +426,9 @@ export class Interface { } } - return logger.throwError("call revert exception", Logger.errors.CALL_EXCEPTION, { + return logger.throwError("call revert exception" + message, Logger.errors.CALL_EXCEPTION, { method: functionFragment.format(), - errorArgs, errorName, errorSignature, reason + data: hexlify(data), errorArgs, errorName, errorSignature, reason }); } diff --git a/packages/providers/src.ts/json-rpc-provider.ts b/packages/providers/src.ts/json-rpc-provider.ts index dbacc3a828..a67ef64440 100644 --- a/packages/providers/src.ts/json-rpc-provider.ts +++ b/packages/providers/src.ts/json-rpc-provider.ts @@ -57,7 +57,7 @@ function checkError(method: string, error: any, params: any): any { const result = spelunk(error); if (result) { return result.data; } - logger.throwError("missing revert data in call exception", Logger.errors.CALL_EXCEPTION, { + logger.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger.errors.CALL_EXCEPTION, { error, data: "0x" }); }