feat: update allowPort check#8355
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
| } | ||
| } | ||
| open.value = true; | ||
| }; |
There was a problem hiding this comment.
There are no obvious issues with the provided code fragment, but there's a minor suggestion for improvement:
Optimizations/Suggestions
- Avoid Unnecessary Try/Catch: The
try/catchblock around API calls is not strictly necessary here, especially given that we only care about handling potential errors when setting up the website URL (if available). We can simplify this by removing thecatchblock.
Here's the revised version of the relevant part:
const acceptParams = async (params: AI.McpServer) => {
hasWebsite.value = false;
mode.value = params.id ? 'edit' : 'create';
try {
const mcpDomainRes = await getMcpDomain();
if (mcpDomainRes.data.connUrl != '') {
hasWebsite.value = true;
}
} finally { // Ensure that the state is correctly updated regardless of success or failure
if (hasWebsite.value) {
let parts = mcpDomainRes.data.connUrl.split(/(https?:\/\/)/).filter(Boolean);
mcpServer.value.protocol = parts[0];
mcpServer.value.url = parts[1];
mcpServer.value.baseUrl = mcpDomainRes.data.connUrl;
}
}
...
} If you want to explicitly handle errors without affecting the logic flow elsewhere, consider using logging instead or wrapping it in a separate error handler function that checks if the operation should be retried. However, for simpler setup workflows, the current approach should suffice.
|
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wanghe-fit2cloud The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |



No description provided.