Return undefined or null instead of throw a error when input ip addr is invalid
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 253
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
If input ip addr or netmask is invalid, it will throw error, then I must use nested try / catch to handle that.
It makes code complicated.
I suggest return a undefined / null value for calculate error. Like behavior of many JS native functions.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the public API that parses the input IP address or netmask and the existing invalid-input behavior. Review how errors are tested, then clarify whether invalid input should produce undefined or null and add coverage for both invalid address and netmask cases; done means callers no longer need nested try/catch for those inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100