# Function: isProtocolError()

```ts
function isProtocolError(error, code?): error is ProtocolError;
```

Defined in: [packages/core/src/utils/errors.ts:48](https://github.com/leifriksheim/minca/blob/main/core/src/utils/errors.ts#L48)

Narrows an unknown thrown value to a protocol error.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `error` | `unknown` |
| `code?` | [`ProtocolErrorCode`](https://minca.dev/api/core/type-aliases/ProtocolErrorCode.md) |

## Returns

`error is ProtocolError`
