Skip to content

Unpack AggregateError inner errors in formatError for better diagnostics#39

Merged
mkcorneli merged 1 commit intomainfrom
ja.aggregate-error-fix
Mar 30, 2026
Merged

Unpack AggregateError inner errors in formatError for better diagnostics#39
mkcorneli merged 1 commit intomainfrom
ja.aggregate-error-fix

Conversation

@juergen-albertsen-exasol
Copy link
Copy Markdown
Contributor

Summary

When connecting to an unreachable Exasol host, the output panel and error messages would show AggregateError with no useful detail. This is because AggregateError (thrown when all WebSocket connection attempts fail) wraps multiple inner errors in an .errors array, which the previous formatError implementation ignored.

Changes

  • formatError now detects AggregateError and recursively unpacks its inner errors into a readable string, e.g. All connection attempts failed: connect ECONNREFUSED 10.0.0.1:8563; connect ETIMEDOUT 10.0.0.2:8563
  • extension.ts and connectionPanel.ts replaced bare String(error) calls with formatError(error), so all error display paths benefit from the same logic
  • Two unit tests added to cover the new behaviour

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mkcorneli
Copy link
Copy Markdown
Collaborator

  • Correctness: The AggregateError check is placed before the instanceof Error check, which is correct since
    AggregateError extends Error — otherwise it'd never trigger. The recursive formatError(e) call on inner errors
    means nested AggregateErrors and non-Error inner values are handled properly.
  • Import paths: extension.ts imports directly from connectionTypes, connectionPanel.ts imports via the
    connectionManager re-export — both are valid, though slightly inconsistent. Minor style nit, not a blocker.
  • Tests: Two good unit tests covering the happy path (message + inner errors) and edge case (no message). Test
    file placement in the existing tlsValidation.test.ts suite makes sense since formatError tests already live
    there.
  • No regressions: The String(error) → formatError(error) replacements are strictly better — formatError
    already handles all the cases String() would, plus the driver's {text, sqlCode} objects.

@mkcorneli mkcorneli merged commit ff04c97 into main Mar 30, 2026
1 check passed
@mkcorneli mkcorneli deleted the ja.aggregate-error-fix branch March 30, 2026 16:37
mikhail-zhadanov added a commit that referenced this pull request Mar 31, 2026
Resolve import conflict: keep both notebook imports and formatError import
from the AggregateError fix (PR #39).
@mikhail-zhadanov
Copy link
Copy Markdown
Collaborator

This PR didn't add anything to changelog so no new release was generated.

@juergen-albertsen-exasol
Copy link
Copy Markdown
Contributor Author

This PR didn't add anything to changelog so no new release was generated.

Not sure what you're trying to say. What do we need to do?

CC @mkcorneli

@mikhail-zhadanov
Copy link
Copy Markdown
Collaborator

@juergen-albertsen-exasol , CI is automatically deploying new release to marketplace if

  1. version number was updated in https://github.com/exasol-labs/exasol-vscode/blob/main/package.json
  2. changes recorded in https://github.com/exasol-labs/exasol-vscode/blob/main/CHANGELOG.md

If not done - changes stay only in github code.

@juergen-albertsen-exasol
Copy link
Copy Markdown
Contributor Author

I created a PR to bump the version: #40

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.

3 participants