This commit is contained in:
parent
1f6c0ab281
commit
dab6ede226
@ -390,6 +390,7 @@ export class Interface {
|
|||||||
let bytes = arrayify(data);
|
let bytes = arrayify(data);
|
||||||
|
|
||||||
let reason: string = null;
|
let reason: string = null;
|
||||||
|
let message = "";
|
||||||
let errorArgs: Result = null;
|
let errorArgs: Result = null;
|
||||||
let errorName: string = null;
|
let errorName: string = null;
|
||||||
let errorSignature: string = null;
|
let errorSignature: string = null;
|
||||||
@ -408,6 +409,11 @@ export class Interface {
|
|||||||
errorName = builtin.name;
|
errorName = builtin.name;
|
||||||
errorSignature = builtin.signature;
|
errorSignature = builtin.signature;
|
||||||
if (builtin.reason) { reason = errorArgs[0]; }
|
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 {
|
} else {
|
||||||
try {
|
try {
|
||||||
const error = this.getError(selector);
|
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(),
|
method: functionFragment.format(),
|
||||||
errorArgs, errorName, errorSignature, reason
|
data: hexlify(data), errorArgs, errorName, errorSignature, reason
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ function checkError(method: string, error: any, params: any): any {
|
|||||||
const result = spelunk(error);
|
const result = spelunk(error);
|
||||||
if (result) { return result.data; }
|
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"
|
error, data: "0x"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user