@davidcal/fec-raptorq
Version:
Node.js wrapper for RaptorQ forward error correction
13 lines (11 loc) • 300 B
JavaScript
/**
* Tries to run an async function and resolves with `:ok(value)` if the function resolved or `:err(error)` if the function rejected.
*/
export const try_async = async (func) => {
try {
return enm.ok(await func());
} catch (e) {
return enm.err(e);
}
};
export const tryAsync = try_async;