@0x:contracts-utils Added RichErrors to LibBytes
This commit is contained in:
committed by
Amir Bandeali
parent
c788db785b
commit
d3db2dcfbb
@@ -1,3 +1,4 @@
|
||||
import * as LibBytesRevertErrors from './lib_bytes_revert_errors';
|
||||
import * as OwnableRevertErrors from './ownable_revert_errors';
|
||||
import * as SafeMathRevertErrors from './safe_math_revert_errors';
|
||||
|
||||
@@ -28,4 +29,4 @@ export {
|
||||
AnyRevertError,
|
||||
} from './revert_error';
|
||||
|
||||
export { OwnableRevertErrors, SafeMathRevertErrors };
|
||||
export { LibBytesRevertErrors, OwnableRevertErrors, SafeMathRevertErrors };
|
||||
|
||||
30
packages/utils/src/lib_bytes_revert_errors.ts
Normal file
30
packages/utils/src/lib_bytes_revert_errors.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { BigNumber } from './configured_bignumber';
|
||||
import { RevertError } from './revert_error';
|
||||
|
||||
export enum InvalidByteOperationErrorCodes {
|
||||
FromLessThanOrEqualsToRequired,
|
||||
ToLessThanOrEqualsLengthRequired,
|
||||
LengthGreaterThanZeroRequired,
|
||||
LengthGreaterThanOrEqualsFourRequired,
|
||||
LengthGreaterThanOrEqualsTwentyRequired,
|
||||
LengthGreaterThanOrEqualsThirtyTwoRequired,
|
||||
LengthGreaterThanOrEqualsNestedBytesLengthRequired,
|
||||
DestinationLengthGreaterThanOrEqualSourceLengthRequired,
|
||||
}
|
||||
|
||||
export class InvalidByteOperationError extends RevertError {
|
||||
constructor(error?: InvalidByteOperationErrorCodes, endpoint?: BigNumber, required?: BigNumber) {
|
||||
super(
|
||||
'InvalidByteOperationError',
|
||||
'InvalidByteOperationError(uint8 error, uint256 endpoint, uint256 required)',
|
||||
{
|
||||
error,
|
||||
endpoint,
|
||||
required,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Register the InvalidByteOperationError type
|
||||
RevertError.registerType(InvalidByteOperationError);
|
||||
Reference in New Issue
Block a user