# Bytes Errors

## `Bytes.InvalidBytesBooleanError`

Thrown when the bytes value cannot be represented as a boolean.

### Examples

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

Bytes.toBoolean(Bytes.from([5]))
// @error: Bytes.InvalidBytesBooleanError: Bytes value `[5]` is not a valid boolean.
// @error: The bytes array must contain a single byte of either a `0` or `1` value.
```

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

## `Bytes.InvalidBytesTypeError`

Thrown when a value cannot be converted to bytes.

### Examples

```ts twoslash
// @noErrors
import { Bytes } from 'ox'

Bytes.from('foo')
// @error: Bytes.InvalidBytesTypeError: Value `foo` of type `string` is an invalid Bytes value.
```

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

## `Bytes.SizeExceedsPaddingSizeError`

Thrown when a the padding size exceeds the maximum allowed size.

### Examples

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

Bytes.padLeft(Bytes.fromString('Hello World!'), 8)
// @error: [Bytes.SizeExceedsPaddingSizeError: Bytes size (`12`) exceeds padding size (`8`).
```

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

## `Bytes.SizeOverflowError`

Thrown when a size exceeds the maximum allowed size.

### Examples

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

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

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

## `Bytes.SliceOffsetOutOfBoundsError`

Thrown when a slice offset is out-of-bounds.

### Examples

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

Bytes.slice(Bytes.from([1, 2, 3]), 4)
// @error: Bytes.SliceOffsetOutOfBoundsError: Slice starting at offset `4` is out-of-bounds (size: `3`).
```

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