Skip to content

Conversation

cola119
Copy link
Member

@cola119 cola119 commented Apr 29, 2022

watch(expr) command of node inspect can accept non-string values, which result in inconsistent bugs.
This PR added the string validation to prevent this issue.

Before

$ node inspect -e "console.log()"
debug> watch()
debug> watch(1)
debug> watchers
  0: undefined = '<Invalid parameters>'
  1: 1 = '<Invalid parameters>'

After

$ node inspect -e "console.log()"
debug> watch()
node:internal/validators:119
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

Uncaught:
TypeError [ERR_INVALID_ARG_TYPE]: The "expression" argument must be of type string. Received undefined

@cola119 cola119 changed the title debugger: add string validation for watch(expr) debugger: add string validation for watch(expr) of node inspect Apr 29, 2022
@nodejs-github-bot nodejs-github-bot added debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run. labels Apr 29, 2022
@cola119 cola119 closed this Feb 19, 2023
@cola119 cola119 deleted the add-string-validaton-for-watch branch February 20, 2023 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants