Skip to content

process: nextTick should not be handled lazily

Rodrigo Muino Tomonari requested to merge github/fork/yorkie/fix/nextTick into master

I got this log from my production clusters:

node.js:430
        callback();
        ^
TypeError: callback is not a function
    at doNTCallback0 (node.js:430:9)
    at process._tickCallback (node.js:359:13)

The stack trace sucks us in some ways, right? Because we can't start debugging from the log, so after we check the type of the callback at first, the terminal will tell us:

node.js:493
        throw new Error('callback is not a function');
        ^
Error: callback is not a function
    at process.nextTick (node.js:493:15)
    at startup (/Users/yorkieliu/workspace/weflex/api/index.js:3:11)
    at Object.<anonymous> (/Users/yorkieliu/workspace/weflex/api/index.js:6:1)
    at Module._compile (module.js:423:26)
    at Object.Module._extensions..js (module.js:430:10)
    at Module.load (module.js:354:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:455:10)
    at startup (node.js:138:18)
    at node.js:976:3

The location /Users/yorkieliu/workspace/weflex/api/index.js:3:11 is in my source file, so I'm able to debug my program with this stack. Obviously, this is an enhancement on stack trace, isn't it :-)

/cc @trevnorris

Merge request reports

Loading