Skip to content

Conversation

@Cerchie
Copy link
Contributor

@Cerchie Cerchie commented Nov 26, 2025

Summary of Changes

Fixes #3060

This PR handles errors at the Flink AI resources level, using Promise.allSettled to track the results of the resource loader and handle them accordingly. There's also a small helper method added to converts a promise rejection reason to an Error instance. 2 unit tests are added as well.

Clicktesting

  1. run extension dev host and log into CCloud
  2. Verify that no errors are thrown for empty Flink AI resoucers when they are loaded
  3. Exit the ext dev host and modify the code to force an error:
    const [connections, tools, models, agents] = await Promise.allSettled([
      loader.getFlinkAIConnections(database, forceDeepRefresh),
      loader.getFlinkAITools(database, forceDeepRefresh),
      Promise.reject(new Error("Test error: Flink AI Models failed")),
      loader.getFlinkAIAgents(database, forceDeepRefresh),
    ]);

or something like this, if the nature of Promise.allSettled is not bubbling up what you want to verify (for me, it failed the other resources when I rejected one):

    if (connections.status === "fulfilled") {
      this.connections = connections.value;
//      resources.push(...this.connections);
//  } else {
      errors.push(["Flink AI Connections", this.toError(connections.reason)]);
    }

Then observe that the error is thrown and you see an appropriate notification.

Screenshot 2025-11-26 at 12 38 25 PM Screenshot 2025-11-26 at 12 19 09 PM

Pull request checklist

Please check if your PR fulfills the following (if applicable):

Tests

  • Added new
  • Updated existing
  • Deleted existing

Release notes

  • Does anything in this PR need to be mentioned in the user-facing CHANGELOG?

@Cerchie Cerchie requested a review from Copilot November 26, 2025 19:51
@Cerchie Cerchie changed the title Compare error handling approaches: Go-style vs TypeScript try/catch Draft: Handle errors at Flink resource level Nov 26, 2025
@Cerchie Cerchie changed the title Draft: Handle errors at Flink resource level Draft: Handle errors at Flink AI resource level Nov 26, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR demonstrates two different error handling approaches for Flink AI resource loading: a TypeScript-style try/catch approach (commit 1) and a Go-style error handling approach with Promise.allSettled (commit 2). The implementation improves error resilience by allowing partial resource loading when some resource types fail, while providing clear error feedback to users.

Key changes:

  • Replaced sequential await calls with concurrent Promise.allSettled for parallel resource loading
  • Added graceful error handling that logs failures and shows user notifications while allowing successful resources to load
  • Added comprehensive test coverage for error scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/viewProviders/multiViewDelegates/flinkAiDelegate.ts Implemented Promise.allSettled-based error handling for Flink AI resource loading with user notifications
src/viewProviders/multiViewDelegates/flinkAiDelegate.test.ts Added test coverage for error handling scenarios when resource loading fails

@Cerchie Cerchie requested a review from Copilot November 26, 2025 20:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

@Cerchie Cerchie marked this pull request as ready for review November 26, 2025 21:42
@Cerchie Cerchie requested a review from a team as a code owner November 26, 2025 21:42
@Cerchie Cerchie changed the title Draft: Handle errors at Flink AI resource level Handle errors at Flink AI resource level Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add error handling in Flink AI delegate fetchChildren()

2 participants