Handle error when no argument is passed
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Currently invoking `index.js` with no arguments throws the error:
``` js
/Users/brandondail/.dev/node-todo/index.js:10
const flag = args[0].charAt(0) === '-' ? args[0] : null
^
TypeError: Cannot read property 'charAt' of undefined
at Object. (/Users/brandondail/.dev/node-todo/index.js:10:21)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
```
Handle this and other argument-based errors gracefully
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading index.js around line 10 and run the CLI with no arguments to reproduce the TypeError. Inspect the argument handling for other invalid or missing values; done means argument-based errors are handled gracefully without an uncaught exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100