# AbiError

A value that is not what its Solidity type allows, or bytes that are not the ABI encoding of
it: an amount out of range, data cut short, a signature that does not parse. It is a value in
the error channel, as every failure is.

```ts
import { AbiError } from "@ethect/core";
```

## Properties

| Property | Type | Holds |
| --- | --- | --- |
| `_tag` | `"AbiError"` | the tag `Effect.catchTag` matches |
| `message` | `string` | which value or which bytes, and why |

## As a Schema

`AbiError.AbiError` is its own Schema. Declared in the failure of a query or of a command, it is
written as its tag and its message, and read back as an `AbiError.AbiError`.

| The error | Written as |
| --- | --- |
| `new AbiError.AbiError({ message: "uint8 takes 0 to 255, got 256" })` | `{ "_tag": "AbiError", "message": "uint8 takes 0 to 255, got 256" }` |

`new` checks nothing: with fields of their types, it never throws.

## When it is raised

| By | When |
| --- | --- |
| [`Abi`](https://ethect.dev/reference/abi/) and [`Fn`](https://ethect.dev/reference/fn/) | a value cannot be encoded as its type, or bytes cannot be decoded as it |
| [`Call`](https://ethect.dev/reference/call/) and [`Tx`](https://ethect.dev/reference/tx/) | the arguments of a call cannot be encoded, or what a node returned cannot be decoded |

## Types

| Type | Is |
| --- | --- |
| `AbiError.AbiError` | the error |
