rs / rs/node-netmask

Return undefined or null instead of throw a error when input ip addr is invalid

Open
#31 2 comments 3 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.