protocol/packages/subproviders/test/utils/report_callback_errors.ts
2018-10-18 22:27:31 +11:00

15 lines
363 B
TypeScript

import { DoneCallback } from '@0x/types';
export const reportCallbackErrors = (done: DoneCallback) => {
return (f: (...args: any[]) => void) => {
const wrapped = async (...args: any[]) => {
try {
f(...args);
} catch (err) {
done(err);
}
};
return wrapped;
};
};