diff --git a/lang/en.json b/lang/en.json index d6762f00..d0e60bdc 100644 --- a/lang/en.json +++ b/lang/en.json @@ -324,7 +324,7 @@ }, "detectPort": { "errors": { - "invalidPort": "Port must be between 1024 and 65535" + "invalidPort": "Port must be between {{ minPort }} and {{ maxPort }}" } }, "PortManagerServer": { @@ -337,7 +337,7 @@ "duplicateInstance": "Failed to start PortManagerServer. An instance of PortManagerServer is already running.", "404": "Could not find a server with instanceId {{ instanceId }}", "409": "Failed to assign port. Server with instanceId {{ instanceId }} is already running on port {{ port }}", - "400": "Invalid port requested. Port must be between 1024 and 65535." + "400": "Invalid port requested. Port must be between {{ minPort }} and {{ maxPort }}." } } }, diff --git a/utils/PortManagerServer.ts b/utils/PortManagerServer.ts index 7b0c9597..53f60bc5 100644 --- a/utils/PortManagerServer.ts +++ b/utils/PortManagerServer.ts @@ -136,7 +136,12 @@ class PortManagerServer { ); return; } else if (port && (port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER)) { - res.status(400).send(i18n(`${i18nKey}.errors.400`)); + res.status(400).send( + i18n(`${i18nKey}.errors.400`, { + minPort: MIN_PORT_NUMBER, + maxPort: MAX_PORT_NUMBER, + }) + ); return; } else { const promise = new Promise<{ [instanceId: string]: number }>( diff --git a/utils/detectPort.ts b/utils/detectPort.ts index ac48671e..24a94822 100644 --- a/utils/detectPort.ts +++ b/utils/detectPort.ts @@ -39,7 +39,10 @@ const i18nKey = 'utils.detectPort'; export function detectPort(port?: number | null): Promise { if (port && (port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER)) { - throwErrorWithMessage(`${i18nKey}.errors.invalidPort`); + throwErrorWithMessage(`${i18nKey}.errors.invalidPort`, { + minPort: MIN_PORT_NUMBER, + maxPort: MAX_PORT_NUMBER, + }); } const portToUse = port || 0;