# AbiError.from

Parses an arbitrary **JSON ABI Error** or **Human Readable ABI Error** into a typed [`AbiError.AbiError`](/api/AbiError/types#abierror).

## Imports

:::code-group
```ts [Named]
import { AbiError } from 'ox'
```

```ts [Entrypoint]
import * as AbiError from 'ox/AbiError'
```
:::

## Examples

### JSON ABIs

```ts twoslash
import { AbiError } from 'ox'

const badSignatureVError = AbiError.from({
  inputs: [{ name: 'v', type: 'uint8' }],
  name: 'BadSignatureV',
  type: 'error'
})

badSignatureVError
//^?
```

### Human Readable ABIs

A Human Readable ABI can be parsed into a typed ABI object:

```ts twoslash
import { AbiError } from 'ox'

const badSignatureVError = AbiError.from(
  'error BadSignatureV(uint8 v)' // [!code hl]
)

badSignatureVError
//^?
```

It is possible to specify `struct`s along with your definitions:

```ts twoslash
import { AbiError } from 'ox'

const badSignatureVError = AbiError.from([
  'struct Signature { uint8 v; }', // [!code hl]
  'error BadSignatureV(Signature signature)'
])

badSignatureVError
//^?
```

## Definition

```ts
function from<abiError>(
  abiError: (abiError | AbiError | string | readonly string[]) & ((abiError extends string ? internal.Signature<abiError> : never) | (abiError extends readonly string[] ? internal.Signatures<abiError> : never) | AbiError),
  options?: from.Options,
): from.ReturnType<abiError>
```

**Source:** [src/core/AbiError.ts](https://github.com/wevm/ox/blob/main/src/core/AbiError.ts#L837)

## Parameters

### abiError

* **Type:** `(abiError | AbiError | string | readonly string[]) & ((abiError extends string ? internal.Signature<abiError> : never) | (abiError extends readonly string[] ? internal.Signatures<abiError> : never) | AbiError)`

The ABI Error to parse.

### options

* **Type:** `from.Options`
* **Optional**

#### options.prepare

* **Type:** `boolean`
* **Optional**

Whether or not to prepare the extracted function (optimization for encoding performance).
When `true`, the `hash` property is computed and included in the returned value.

## Return Type

Typed ABI Error.

`from.ReturnType<abiError>`
