@0x/utils: ZeroExRevertErrors.

This commit is contained in:
Lawrence Forman 2020-04-08 13:55:51 -04:00
parent 3e9309c003
commit 7f26fafed7
5 changed files with 81 additions and 0 deletions

View File

@ -1,4 +1,13 @@
[
{
"version": "5.5.0",
"changes": [
{
"note": "Add `ZeroExRevertErrors`",
"pr": 2540
}
]
},
{
"version": "5.4.1",
"changes": [

View File

@ -43,3 +43,9 @@ export import LibBytesRevertErrors = require('./revert_errors/utils/lib_bytes_re
export import OwnableRevertErrors = require('./revert_errors/utils/ownable_revert_errors');
export import ReentrancyGuardRevertErrors = require('./revert_errors/utils/reentrancy_guard_revert_errors');
export import SafeMathRevertErrors = require('./revert_errors/utils/safe_math_revert_errors');
export const ZeroExRevertErrors = {
Common: require('./revert_errors/zero-ex/common_revert_errors'),
Proxy: require('./revert_errors/zero-ex/proxy_revert_errors'),
SimpleFunctionRegistry: require('./revert_errors/zero-ex/simple_function_registry_revert_errors'),
};

View File

@ -0,0 +1,17 @@
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file
export class OnlyCallableBySelfError extends RevertError {
constructor(sender?: string) {
super('OnlyCallableBySelfError', 'OnlyCallableBySelfError(address sender)', {
sender,
});
}
}
const types = [OnlyCallableBySelfError];
// Register the types we've defined.
for (const type of types) {
RevertError.registerType(type);
}

View File

@ -0,0 +1,32 @@
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file
export class NotImplementedError extends RevertError {
constructor(selector?: string) {
super('NotImplementedError', 'NotImplementedError(bytes4 selector)', {
selector,
});
}
}
export class AlreadyBootstrappedError extends RevertError {
constructor() {
super('AlreadyBootstrappedError', 'AlreadyBootstrappedError()', {});
}
}
export class InvalidBootstrapCallerError extends RevertError {
constructor(caller?: string, expectedCaller?: string) {
super('InvalidBootstrapCallerError', 'InvalidBootstrapCallerError(address caller, address expectedCaller)', {
caller,
expectedCaller,
});
}
}
const types = [AlreadyBootstrappedError, InvalidBootstrapCallerError, NotImplementedError];
// Register the types we've defined.
for (const type of types) {
RevertError.registerType(type);
}

View File

@ -0,0 +1,17 @@
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file
export class NoRollbackHistoryError extends RevertError {
constructor(selector?: string) {
super('NoRollbackHistoryError', 'NoRollbackHistoryError(bytes4 selector)', {
selector,
});
}
}
const types = [NoRollbackHistoryError];
// Register the types we've defined.
for (const type of types) {
RevertError.registerType(type);
}