8000 Return callback error vs throwing by MasterOdin · Pull Request #180 · http-party/node-portfinder · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Return callback error vs throwing #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

MasterOdin
Copy link
Contributor
@MasterOdin MasterOdin commented Apr 2, 2025

Fixes #171

PR makes it so that instead of having getPort throw errors in some cases, it'll instead return an error on the callback. This allows for a singular error handling necessary for end users (namely around the callback), vs requiring them to both worry about the callback as well as wrapping the getPort call in a try/catch.

I think that there's more options validation that could happen here (e.g. if options.startPort is provided, should probably have similar checks), but that can be done in a follow-up once this pattern is established on how to return errors to the user.

8000
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
@eriktrom
Copy link
Member

Yep I agree. Thanks again for helping out.

@eriktrom eriktrom merged commit 2110ec1 into http-party:master Apr 14, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove throws from getPort
2 participants
0