Closed amardeokar23 closed 3 years ago
i never answered this sorry
so u are right -- problem is long ago i did a bunch of error catching and bubbling to the user stuff, then when windows WSL was released there was a flood of syscall errors (macos touchbar did the same) and at that point i removed errors to help the user b/c the syscall errors were so os dependent that I couldn't say for sure I wasn't making things harder to debug than easier...
tldr...
Errors generated due to providing startPort < 0 OR basePort > highestPort need to be returned in the callback if callback is provided. Otherwise errors will not be caught unless user call getPort() inside try-catch.
https://github.com/http-party/node-portfinder/blob/8895293a96a41a454b6648b50ecc7bff7f13fc22/lib/portfinder.js#L118