-
-
Notifications
You must be signed in to change notification settings - Fork 796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/verbose handler loader #209
Feature/verbose handler loader #209
Conversation
Hi @emmoistner thanks for the PR.
Thanks |
Great questions. Brief
I would be good with making this the default loader if 1.a is true, 1.b matches output from the verboseHandlerLoader or we are okay with stack traces being better locally, and we are okay with the caveats. In Depth
|
@dherault Ping, any thoughts? |
@emmoistner sorry for the wait. I still think this is too much diff for a single feature. Moreover, I'm working on v4 to tackle te code quality problem. The idea is great thought. |
@dherault Just a final note. If you decide to go with the same workflow, you will most likely run into the same problems with base syntax errors with empty stack traces. It just something to think about when using node 4.x Reference: nodejs/node#2762 |
Verbose Handler Loader
Backstory
Node v4.0 has some trouble with displaying lineNumbers, fileNames from code that was dynamically required, like this project does. More information on the issues (nodejs/node#2762).
Goal
Provide devs an option to receive better stack traces from SyntaxErrors.
implementation
A new parameter,
--verboseHandlerLoader
(Default: false).When provided, it will run a different loader function. If the code fails to load, it will spawn a childProcess
node ${handlerPath}.js
attempting to retrieve more in depth debug/stack information.By default the previous handlerLoader is ran which only requires the handlerModule.
Additional bugfixes (tests)
Added before and after hooks to integration tests to handle restoring functionHelper.createHandler
Commits are broken up so this can be easily separated out.
Notes
Why child process execSync node?
Screenshots
Example Manual Test Setup (Replication)
For example replace line 46 of
manual_test/handler.js
with an intentional SyntaxError likeBefore
After (default: without --verboseHandlerLoader)
After (with --verboseHandlerLoader)
Any suggestions would be greatly appreciated.