@0x/utils
: Add docstring for raw
constructor parameter in RevertError
.
`@0x/utils`: Use `...is.instanceof()` pattern in `RevertError` tests.
This commit is contained in:
parent
20ba23fe5f
commit
b07fc95c81
@ -14,6 +14,10 @@
|
|||||||
"note": "Add `LibFixedMath` `RevertError` types.",
|
"note": "Add `LibFixedMath` `RevertError` types.",
|
||||||
"pr": 2109
|
"pr": 2109
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"note": "Add `RawRevertError` `RevertError` type.",
|
||||||
|
"pr": 2109
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"note": "Make `RevertError.decode()` optionally return a `RawRevertError` if the selector is unknown.",
|
"note": "Make `RevertError.decode()` optionally return a `RawRevertError` if the selector is unknown.",
|
||||||
"pr": 2109
|
"pr": 2109
|
||||||
|
@ -145,6 +145,9 @@ export abstract class RevertError extends Error {
|
|||||||
* Parameters that are left undefined will not be tested in equality checks.
|
* Parameters that are left undefined will not be tested in equality checks.
|
||||||
* @param declaration Function-style declaration of the revert (e.g., Error(string message))
|
* @param declaration Function-style declaration of the revert (e.g., Error(string message))
|
||||||
* @param values Optional mapping of parameters to values.
|
* @param values Optional mapping of parameters to values.
|
||||||
|
* @param raw Optional encoded form of the revert error. If supplied, this
|
||||||
|
* instance will be treated as a `RawRevertError`, meaning it can only
|
||||||
|
* match other `RawRevertError` types with the same encoded payload.
|
||||||
*/
|
*/
|
||||||
protected constructor(name: string, declaration?: string, values?: ValueMap, raw?: string) {
|
protected constructor(name: string, declaration?: string, values?: ValueMap, raw?: string) {
|
||||||
super(createErrorMessage(name, values));
|
super(createErrorMessage(name, values));
|
||||||
|
@ -146,7 +146,7 @@ describe('RevertError', () => {
|
|||||||
it('should decode an unknown selector as a `RawRevertError`', () => {
|
it('should decode an unknown selector as a `RawRevertError`', () => {
|
||||||
const _encoded = encoded.substr(0, 2) + '00' + encoded.substr(4);
|
const _encoded = encoded.substr(0, 2) + '00' + encoded.substr(4);
|
||||||
const decoded = RevertError.decode(_encoded, true);
|
const decoded = RevertError.decode(_encoded, true);
|
||||||
expect(decoded instanceof RawRevertError).to.be.true();
|
expect(decoded).is.instanceof(RawRevertError);
|
||||||
});
|
});
|
||||||
it('should fail to decode a malformed ABI encoded revert error', () => {
|
it('should fail to decode a malformed ABI encoded revert error', () => {
|
||||||
const _encoded = encoded.substr(0, encoded.length - 1);
|
const _encoded = encoded.substr(0, encoded.length - 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user