Skip to content
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

Improve module location parsing (of stack info) when adding hook #3447

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

Steve-Mcl
Copy link
Contributor

fixes #3401

  • Bugfix (non-breaking change which fixes an issue)

Proposed changes

basic...

  • handles brackets and no brackets in stack line
  • handles short stack

details...

  • Ensure "TypeError: Cannot read property 'slice' of undefined" if called from within callback does not occur
  • if short stack, location is assigned "unknown:0:0" and node-red debug log will contain the hook name and stack
  • if an error occurs parsing a stack, location is assigned "unknown:0:0" and node-red debug log will contain the hook name and stack

Local Tests...

I wrapped the new code in a temporary function and tested locally in a Node JS 16 env REPL...
image

Future:

refactor code to permit testing?

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run grunt to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

- fixes node-red#3401
- handles brackets and no brackets in stack line
- handles short stack
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 67.357% when pulling 2b958f5 on Steve-Mcl:fix-hook-module-location into 95f7177 on node-red:master.

@knolleary knolleary merged commit 263e68e into node-red:master Feb 15, 2022
@Steve-Mcl Steve-Mcl deleted the fix-hook-module-location branch February 15, 2022 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants