Skip to content

fix: recover from uncaught extension errors #1440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mszu
Copy link

@mszu mszu commented Jun 5, 2025

If any extension raises an uncaught exception while generating search results, the user is presented with an ugly stack trace and the main UI stops updating (see e.g. #1411):

error

This PR simply catches exceptions that surface while iterating over extensions during search result retrieval and logs the errors instead of dying. No results are displayed from the offending extension:

success_log

success

@mszu mszu requested a review from oliverschwendener as a code owner June 5, 2025 08:13
const extensionRegistry = <ExtensionRegistry>{ getAll: () => [extension1, extension2] };
const getValueMock = vi.fn().mockReturnValue([extension1.id, extension2.id]);
const settingsManager = <SettingsManager>{ getValue: (key, defaultValue) => getValueMock(key, defaultValue) };
const mockedLogger = <Logger>({ error: vi.fn() } as unknown);
Copy link
Author

Choose a reason for hiding this comment

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

The as unknown intermediate cast is to avoid having to mock the unused debug/info/warn logger functions

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