Skip to content

[AutoDevNext] FLOW-2255 atlascode: Error:RovoDevChatProvider.processError - #1880

Open
atlassian[bot] wants to merge 1 commit into
mainfrom
autodevnext/FLOW-2255-atlascode-error-rovodevchatprovider-processerror
Open

[AutoDevNext] FLOW-2255 atlascode: Error:RovoDevChatProvider.processError#1880
atlassian[bot] wants to merge 1 commit into
mainfrom
autodevnext/FLOW-2255-atlascode-error-rovodevchatprovider-processerror

Conversation

@atlassian

@atlassian atlassian Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🤖 This PR was generated by AutoDev bot. For any help or concerns, reach out on #devai-autodev-community.

Action needed: please review, approve, and merge if this PR is ready. AutoDev will not automatically merge/decline it. We collect decline feedback to improve quality. Thanks!
Changes needed or questions? Leave comments. Autodev now addresses PR comments every few hours.

Summary

Fixes an unhandled error in RovoDevChatProvider.processError (FLOW-2255). The error handler itself was throwing when it encountered non-Error values or when the webview was unavailable.

Root Cause

Two issues were identified:

  1. Non-Error thrown values: In executeStreamingApiWithErrorHandling, the catch block passed the caught value directly to processError(error: Error, ...) without checking if it was actually an Error instance. If a string, number, or plain object was thrown, error.message would be undefined, and buildErrorDetails(error) could throw — causing an unhandled exception from within the error handler itself.

  2. Undefined webview: processError used the non-null assertion this._webView! to get the webview reference. If _webView was undefined (e.g., the panel was disposed or not yet set), this would throw a TypeError inside the error handler, making an unhandled exception escape from processError.

Changes

  • src/rovo-dev/rovoDevChatProvider.ts:

    • In executeStreamingApiWithErrorHandling: rename caught variable to rawError and coerce it to an Error instance before any further processing.
    • In processError: replace this._webView! with a safe guard — if _webView is undefined, log a warning via Logger.warn and return early instead of throwing.
  • src/rovo-dev/rovoDevChatProvider.test.ts:

    • Added test: thrown plain string is handled gracefully (shows error dialog without throwing).
    • Added test: processError does not throw when webview is unavailable.
  • CHANGELOG.md: Added entry under 4.0.31 Bug Fixes.

Recent PR change-site overlap

The Bitbucket PR clash check was not applicable — this repository is hosted on GitHub. No clash check was performed.

Notes for Reviewers

  • The fix in executeStreamingApiWithErrorHandling is minimal: only the catch binding is renamed and a coercion line is added.
  • The processError guard is defense-in-depth: protecting the error handler from its own failure is critical for reliability.
  • Tests could not be executed in this environment due to a pre-existing Jest configuration issue. The linter (ESLint) ran successfully via the pre-commit hook.

Rovo Dev code review: Rovo Dev couldn't review this pull request
Rovo Dev does not review pull requests created by bot accounts.

…sError

- Coerce non-Error thrown values to Error instances in
  executeStreamingApiWithErrorHandling before passing to processError,
  so that thrown strings/objects no longer cause processError itself to
  throw (e.g. accessing .message on undefined).
- Guard against undefined _webView in processError: instead of using
  the non-null assertion operator (!), check for the webview and log a
  warning then return early if it is not available, preventing the
  error handler from throwing an unhandled exception.
- Add two new unit tests covering: (1) a thrown plain string being
  handled gracefully with an error dialog shown, and (2) processError
  not throwing when the webview is unavailable.

Resolves: FLOW-2255
@atlassian-cla-bot

Copy link
Copy Markdown

Thank you for your submission! Like many open source projects, we ask that you sign our CLA (Contributor License Agreement) before we can accept your contribution.
If your email is listed below, please ensure that you sign the CLA with the same email address.

The following users still need to sign our CLA:
❌rayCodingNow

Already signed the CLA? To re-check, try refreshing the page.

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.

1 participant