<!--- await-to-js.stories.mdx --->

import { Meta } from '@storybook/addon-docs';

<Meta title="utils/await-to-js" />

# await-to-js

Async await wrapper for easy error handling

## Usage

```js
import { to } from '@strapi/helper-plugin';

const [err, response] = await to(promise);

if (err) {
  throw new Error(err)
}

...else continue

```
