[**tevm**](../../README.md) *** [tevm](../../modules.md) / [errors](../README.md) / BaseError # Abstract Class: BaseError Base class for custom errors in TEVM. This class is abstract and should be extended by other error classes. ## Implements ## Extends - `Error` ## Extended by - [`InvalidJsonError`](../../server/classes/InvalidJsonError.md) - [`ReadRequestBodyError`](../../server/classes/ReadRequestBodyError.md) - [`AccountLockedError`](AccountLockedError.md) - [`BlobGasLimitExceededError`](BlobGasLimitExceededError.md) - [`BlockGasLimitExceededError`](BlockGasLimitExceededError.md) - [`ChainIdMismatchError`](ChainIdMismatchError.md) - [`ContractExecutionFailedError`](ContractExecutionFailedError.md) - [`ExecutionError`](ExecutionError.md) - [`GasLimitExceededError`](GasLimitExceededError.md) - [`InsufficientFundsError`](InsufficientFundsError.md) - [`InsufficientPermissionsError`](InsufficientPermissionsError.md) - [`InternalError`](InternalError.md) - [`InternalEvmError`](InternalEvmError.md) - [`InvalidAddressError`](InvalidAddressError.md) - [`InvalidGasPriceError`](InvalidGasPriceError.md) - [`InvalidParamsError`](InvalidParamsError.md) - [`InvalidRequestError`](InvalidRequestError.md) - [`InvalidSignatureError`](InvalidSignatureError.md) - [`InvalidTransactionError`](InvalidTransactionError.md) - [`LimitExceededError`](LimitExceededError.md) - [`MethodNotFoundError`](MethodNotFoundError.md) - [`MethodNotSupportedError`](MethodNotSupportedError.md) - [`NonceAlreadyUsedError`](NonceAlreadyUsedError.md) - [`NonceTooHighError`](NonceTooHighError.md) - [`NonceTooLowError`](NonceTooLowError.md) - [`NoSignerAvailableError`](NoSignerAvailableError.md) - [`ParseError`](ParseError.md) - [`PendingTransactionTimeoutError`](PendingTransactionTimeoutError.md) - [`RateLimitExceededError`](RateLimitExceededError.md) - [`ResourceNotFoundError`](ResourceNotFoundError.md) - [`ResourceUnavailableError`](ResourceUnavailableError.md) - [`RevertError`](RevertError.md) - [`TransactionRejectedError`](TransactionRejectedError.md) - [`TransactionTooLargeError`](TransactionTooLargeError.md) - [`TransactionUnderpricedError`](TransactionUnderpricedError.md) - [`UnknownBlockError`](UnknownBlockError.md) - [`UnsupportedChainError`](UnsupportedChainError.md) - [`ForkError`](ForkError.md) - [`NoForkTransportSetError`](NoForkTransportSetError.md) - [`NoForkUrlSetError`](NoForkUrlSetError.md) ## Implements - `BaseErrorType` ## Constructors ### Constructor > **new BaseError**(`shortMessage`, `args`, `_tag`, `code?`): `BaseError` #### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `shortMessage` | `string` | A short, human-readable summary of the error. | | `args` | [`BaseErrorParameters`](../type-aliases/BaseErrorParameters.md) | - | | `_tag` | `string` | Internal tag for the error. | | `code?` | `number` | Error code analogous to the code in JSON RPC error. | #### Returns `BaseError` #### Overrides `Error.constructor` ## Properties | Property | Modifier | Type | Description | Overrides | Inherited from | | ------ | ------ | ------ | ------ | ------ | ------ | | `_tag` | `public` | `string` | - | - | - | | `cause` | `public` | `any` | - | `Error.cause` | - | | `code` | `public` | `number` | - | - | - | | `details` | `public` | `string` | - | - | - | | `docsPath` | `public` | `string` \| `undefined` | - | - | - | | `message` | `public` | `string` | - | - | `Error.message` | | `metaMessages` | `public` | `string`[] \| `undefined` | - | - | - | | `name` | `public` | `string` | - | - | `Error.name` | | `shortMessage` | `public` | `string` | - | - | - | | `stack?` | `public` | `string` | - | - | `Error.stack` | | `version` | `public` | `string` | - | - | - | | `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | - | `Error.stackTraceLimit` | ## Methods ### walk() > **walk**(`fn?`): `unknown` Walks through the error chain. #### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `fn?` | `Function` | A function to execute on each error in the chain. | #### Returns `unknown` The first error that matches the function, or the original error. #### Implementation of `BaseErrorType.walk` *** ### captureStackTrace() > `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void` Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called. ```js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` ``` The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`. The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace. The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance: ```js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a(); ``` #### Parameters | Parameter | Type | | ------ | ------ | | `targetObject` | `object` | | `constructorOpt?` | `Function` | #### Returns `void` #### Inherited from `Error.captureStackTrace` *** ### isError() > `static` **isError**(`error`): `error is Error` Indicates whether the argument provided is a built-in Error instance or not. #### Parameters | Parameter | Type | | ------ | ------ | | `error` | `unknown` | #### Returns `error is Error` #### Inherited from `Error.isError` *** ### prepareStackTrace() > `static` **prepareStackTrace**(`err`, `stackTraces`): `any` #### Parameters | Parameter | Type | | ------ | ------ | | `err` | `Error` | | `stackTraces` | `CallSite`[] | #### Returns `any` #### See https://v8.dev/docs/stack-trace-api#customizing-stack-traces #### Inherited from `Error.prepareStackTrace`