Skip to content

Commit

Permalink
Fix port validation in Create Component from Local Codebase
Browse files Browse the repository at this point in the history
```
rejected promise not handled within 1 second: TypeError: Cannot read properties of undefined (reading 'toString')
extensionHostProcess.js:162
stack trace: TypeError: Cannot read properties of undefined (reading 'toString')
	at validatePortNumber (/home/jeremy/projects/vscode-openshift-tools/source/vscode-openshift-tools/out/src/webview/common-ext/createComponentHelpers.js:170:29)
	at gh.<anonymous> (/home/jeremy/projects/vscode-openshift-tools/source/vscode-openshift-tools/out/src/webview/create-component/createComponentLoader.js:193:95)
	at Generator.next (<anonymous>)
	at /home/jeremy/projects/vscode-openshift-tools/source/vscode-openshift-tools/out/src/webview/create-component/createComponentLoader.js:8:71
	at new Promise (<anonymous>)
	at __awaiter (/home/jeremy/projects/vscode-openshift-tools/source/vscode-openshift-tools/out/src/webview/create-component/createComponentLoader.js:4:12)
	at gh.messageHandler [as value] (/home/jeremy/projects/vscode-openshift-tools/source/vscode-openshift-tools/out/src/webview/create-component/createComponentLoader.js:91:16)
```

Signed-off-by: Victor Rubezhny <[email protected]>
  • Loading branch information
vrubezhny committed Oct 13, 2024
1 parent cc24fb8 commit fb6ea2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/webview/common-ext/createComponentHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export function validateName(name: string, isComponentBasedValidation = true): s
*/
export function validatePortNumber(portNumber: number): string {
let validationMessage: string | null;
const port = portNumber.toString();
const port = portNumber ? portNumber.toString() : '';
if (NameValidator.emptyName('Empty', port) === null) {
validationMessage = NameValidator.lengthName(
'Port number length should be between 1-5 digits',
Expand Down

0 comments on commit fb6ea2a

Please sign in to comment.