[**tevm**](../../README.md)
***
[tevm](../../modules.md) / [errors](../README.md) / InvalidStorageRootError
# Class: InvalidStorageRootError
Represents an error that occurs when the storage root parameter is invalid.
This error is typically encountered when a transaction or operation references a storage root parameter that is invalid or does not conform to the expected structure.
## Example
```javascript
import { InvalidStorageRootError } from '@tevm/errors'
import { createMemoryClient } from '@tevm/memory-client'
const client = createMemoryClient()
try {
await client.setAccount({
address: '0x...',
storageRoot: 'invalid', // This should be a valid storage root
})
} catch (error) {
if (error instanceof InvalidStorageRootError) {
console.error('Invalid storage root:', error.message)
console.log('Documentation:', error.docsLink)
}
}
```
## Extends
- [`InvalidParamsError`](InvalidParamsError.md)
## Constructors
### Constructor
> **new InvalidStorageRootError**(`message`, `args?`): `InvalidStorageRootError`
Constructs an InvalidStorageRootError.
#### Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `message` | `string` | Human-readable error message. |
| `args?` | [`InvalidStorageRootErrorParameters`](../type-aliases/InvalidStorageRootErrorParameters.md) | Additional parameters for the InvalidStorageRootError. |
#### Returns
`InvalidStorageRootError`
#### Overrides
[`InvalidParamsError`](InvalidParamsError.md).[`constructor`](InvalidParamsError.md#constructor)
## Properties
| Property | Modifier | Type | Description | Inherited from |
| ------ | ------ | ------ | ------ | ------ |
| `_tag` | `public` | `string` | - | [`InvalidParamsError`](InvalidParamsError.md).[`_tag`](InvalidParamsError.md#_tag) |
| `cause` | `public` | `any` | - | [`InvalidParamsError`](InvalidParamsError.md).[`cause`](InvalidParamsError.md#cause) |
| `code` | `public` | `number` | - | [`InvalidParamsError`](InvalidParamsError.md).[`code`](InvalidParamsError.md#code) |
| `details` | `public` | `string` | - | [`InvalidParamsError`](InvalidParamsError.md).[`details`](InvalidParamsError.md#details) |
| `docsPath` | `public` | `string` \| `undefined` | - | [`InvalidParamsError`](InvalidParamsError.md).[`docsPath`](InvalidParamsError.md#docspath) |
| `message` | `public` | `string` | - | [`InvalidParamsError`](InvalidParamsError.md).[`message`](InvalidParamsError.md#message) |
| `metaMessages` | `public` | `string`[] \| `undefined` | - | [`InvalidParamsError`](InvalidParamsError.md).[`metaMessages`](InvalidParamsError.md#metamessages) |
| `name` | `public` | `string` | - | [`InvalidParamsError`](InvalidParamsError.md).[`name`](InvalidParamsError.md#name) |
| `shortMessage` | `public` | `string` | - | [`InvalidParamsError`](InvalidParamsError.md).[`shortMessage`](InvalidParamsError.md#shortmessage) |
| `stack?` | `public` | `string` | - | [`InvalidParamsError`](InvalidParamsError.md).[`stack`](InvalidParamsError.md#stack) |
| `version` | `public` | `string` | - | [`InvalidParamsError`](InvalidParamsError.md).[`version`](InvalidParamsError.md#version) |
| `code` | `static` | `number` | The error code for InvalidParamsError. | [`InvalidParamsError`](InvalidParamsError.md).[`code`](InvalidParamsError.md#code-1) |
| `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. | [`InvalidParamsError`](InvalidParamsError.md).[`stackTraceLimit`](InvalidParamsError.md#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.
#### Inherited from
[`InvalidParamsError`](InvalidParamsError.md).[`walk`](InvalidParamsError.md#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
[`InvalidParamsError`](InvalidParamsError.md).[`captureStackTrace`](InvalidParamsError.md#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
[`InvalidParamsError`](InvalidParamsError.md).[`isError`](InvalidParamsError.md#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
[`InvalidParamsError`](InvalidParamsError.md).[`prepareStackTrace`](InvalidParamsError.md#preparestacktrace)