@0x/utils: Tweak RevertError to produce a meaningful Error message/stack trace.

`@0x/utils`: Add more `RevertError` decoding/transforming functions (such as `decodeThrownErrorAsRevertError()`)
This commit is contained in:
Lawrence Forman
2019-05-18 02:06:00 -04:00
committed by Amir Bandeali
parent d480f8d82a
commit eaa4373a18
4 changed files with 126 additions and 11 deletions

View File

@@ -17,7 +17,7 @@ class DescendantRevertError extends StringRevertError {
class CustomRevertError extends RevertError {
public constructor(message?: string) {
super('CustomRevertError(string message)', { message });
super('CustomRevertError', 'CustomRevertError(string message)', { message });
}
}
@@ -56,7 +56,7 @@ describe('RevertError', () => {
it('should throw when registering an already registered signature', () => {
class CustomRevertError2 extends RevertError {
public constructor() {
super(new CustomRevertError().signature, {});
super('CustomRevertError2', new CustomRevertError().signature, {});
}
}
expect(() => RevertError.registerType(CustomRevertError2)).to.throw();