# Hex Errors

## `Hex.InvalidHexBooleanError`

Thrown when the provided hex value cannot be represented as a boolean.

### Examples

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

Hex.toBoolean('0xa')
// @error: Hex.InvalidHexBooleanError: Hex value `"0xa"` is not a valid boolean.
// @error: The hex value must be `"0x0"` (false) or `"0x1"` (true).
```

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

## `Hex.InvalidHexTypeError`

Thrown when the provided value is not a valid hex type.

### Examples

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

Hex.assert(1)
// @error: Hex.InvalidHexTypeError: Value `1` of type `number` is an invalid hex type.
```

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

## `Hex.SizeExceedsPaddingSizeError`

Thrown when the size of the value exceeds the pad size.

### Examples

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

Hex.padLeft(
  '0x1a4e12a45a21323123aaa87a897a897a898a6567a578a867a98778a667a85a875a87a6a787a65a675a6a9',
  32
)
// @error: Hex.SizeExceedsPaddingSizeError: Hex size (`43`) exceeds padding size (`32`).
```

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

## `Hex.SizeOverflowError`

Thrown when the size of the value exceeds the expected max size.

### Examples

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

Hex.fromString('Hello World!', { size: 8 })
// @error: Hex.SizeOverflowError: Size cannot exceed `8` bytes. Given size: `12` bytes.
```

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

## `Hex.SliceOffsetOutOfBoundsError`

Thrown when the slice offset exceeds the bounds of the value.

### Examples

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

Hex.slice('0x0123456789', 6)
// @error: Hex.SliceOffsetOutOfBoundsError: Slice starting at offset `6` is out-of-bounds (size: `5`).
```

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