1 2 3 4 5 6 7 8 9 10 11 12 13 14
import { DoneCallback } from '../../src/types'; export const reportCallbackErrors = (done: DoneCallback) => { return (f: (...args: any[]) => void) => { const wrapped = (...args: any[]) => { try { f(...args); } catch (err) { done(err); } }; return wrapped; }; };