Skip to content

Commit 4f08eea

Browse files
committed
chore: Improve error message when port is not in the right range
1 parent 470e5a7 commit 4f08eea

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ export abstract class AbstractService extends events.EventEmitter {
7777
checkTypes.assert.number(options.port);
7878
checkTypes.assert.integer(options.port);
7979
checkTypes.assert.positive(options.port);
80-
checkTypes.inRange(options.port, 0, 65535);
80+
if (!checkTypes.inRange(options.port, 0, 65535)) {
81+
throw new Error(
82+
`Port number ${options.port} is not in the range 0-65535`
83+
);
84+
}
8185

8286
if (checkTypes.not.inRange(options.port, 1024, 49151)) {
8387
logger.warn(

0 commit comments

Comments
 (0)