3 ms·
Note that casync gives you somewhat ok stack traces (with language level support it could be better) for example: const {casync} = require('./casync.js');
by BenoitEssiambre 6y ago
Note that casync gives you somewhat ok stack traces (with language level support it could be better) for example:
const {casync} = require('./casync.js');
let inner=casync(function*(next){
throw new Error("test err");
});
let outer=casync(function*(next){
yield inner(next);
});
outer((err)=>{throw err;});
Gives you
Error: test err
at /home/benoit/Documents/casync/errorTest.js:4:8
at Generator.next (<anonymous>)
at doNext (/home/benoit/Documents/casync/casync.js:26:12)
at next (/home/benoit/Documents/casync/casync.js:44:5)
at /home/benoit/Documents/casync/casync.js:49:3
at /home/benoit/Documents/casync/errorTest.js:8:8
at Generator.next (<anonymous>)
at doNext (/home/benoit/Documents/casync/casync.js:26:12)
at next (/home/benoit/Documents/casync/casync.js:44:5)
at /home/benoit/Documents/casync/casync.js:49:3
If you skip the lines inside casync which are in most case irrelevant you get:
Error: test err
at /home/benoit/Documents/casync/errorTest.js:4:8
at /home/benoit/Documents/casync/errorTest.js:8:8