try
try await a function , when throw error will console.error(error)
deps.js
export in your export {default as _try} from 'https://deno.land/x/try@0.0.3/lib/index.js'
source code
export default (func, args...)=>
try
return await func(...args)
catch err
console.error(err)
use example
coffeescript version
import _try from './index.js'
test = (a, b, c)=>
console.log "args", a, b ,c
throw new Error('error')
_try test, 1, 2, 3
javascript version
// Generated by CoffeeScript 2.5.1
var test;
import _try from './index.js';
test = (a, b, c) => {
console.log("args", a, b, c);
throw new Error('error');
};
_try(test, 1, 2, 3);
//# sourceMappingURL=index_test.js.map