Mark an error as transient, meaning you can retry.
const transient = require('transient-error')
const err = transient(new Error('Could not connect'))
A consumer can then do:
if (err.transient) {
// Retry
}
Becomes useful when multiple modules use this, as a simple contract.
With npm do:
npm install transient-error
MIT © 2020-present Vincent Weevers