Programmatically set error
Sometimes you may wish to set the error programmatically, unrelated to the actual promise.
import promistate from 'promistate'
const promise = promistate(() => fetch('...'))
promise.error = new Error('internal error')
or with the react hook:
import { usePromistate } from 'promistate/lib/react'
const [promise, actions] = usePromistate(() => fetch('...'))
actions.setError(new Error('internal error'))