debugger: add string validation for watch(expr) of `node inspect`
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