UNPKG

@botonic/plugin-contentful

Version:

Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet

21 lines (19 loc) 500 B
export function isError(e: any): e is Error { const exception = e as Error return !!exception.name && !!exception.message } export function rethrowDecorator< Args extends any[], Return, F extends (...args: Args) => Promise<Return>, >(func: F, beforeRethrow: (error: any, ...args: Args) => Promise<void>): F { const f = async (...args: Args) => { try { return await func(...args) } catch (e) { await beforeRethrow(e, ...args) throw e } } return f as F }