co-debug
Better debug information for co.
co-debug
turns
TypeError: You may only yield a function, promise, generator, array, or object, but the following object was passed: "undefined"
at next (co-debug/node_modules/co/index.js:101:25)
...
into
TypeError: You may only yield a function, promise, generator, array, or object, but the following object was passed: "undefined"
co-debug/test/test.js function: foo
0: yield bar()
1: yield Promise.resolve()
at next (co-debug/node_modules/co/index.js:101:25)
...
Install
npm i co-debug
You may need to install co
by yourself.
Usage
node -r co-debug
Or add require('co-debug')
to your main file and make sure it's loaded before other packages:
const Koa = const app = app
Notes
co-debug
has some limitations
co-debug
only can tell:
- The function name that throws error
- The list of
yield
within the function - The file path that contains the function
Examples:
co-debug/test/test.js function: foo
0: yield bar()
1: yield Promise.resolve()
co-debug
may have trouble working with transpilers.
co-debug
when needed
Only use if processenvNODE_ENV !== 'production' const co = // other stuffs