Skip to content
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

handle not found files for plugins properly #6002

Merged
merged 1 commit into from
Aug 21, 2019

Conversation

akosyakov
Copy link
Member

@akosyakov akosyakov commented Aug 21, 2019

What it does

handle not found files for plugins properly:

  • don't fail if a file is found
  • don't swallow an error bug log it
  • only send 404 if request was not responded already

How to test

  1. Clone https://github.com/vinokurig/Test.git under plugins and compile it
  2. Start the browser example
  3. Open the node dependency view
  4. Check that elements have icons and no errors in logs

Review checklist

Reminder for reviewers

@akosyakov
Copy link
Member Author

@yeweiasia Could you check whether you can reproduce #5967 with this PR?

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

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

The only "danger" I see with this change is that there is a code path that does not send a response to the client. The old code would always send a response, even if too late in some cases.

packages/plugin-ext/src/hosted/node/plugin-reader.ts Outdated Show resolved Hide resolved
packages/plugin-ext/src/hosted/node/plugin-reader.ts Outdated Show resolved Hide resolved
@akosyakov
Copy link
Member Author

The only "danger" I see with this change is that there is a code path that does not send a response to the client. The old code would always send a response, even if too late in some cases.

The old code was always failing because it was trying to send an error response when a file was found or request was already closed with another error.

- don't fail if a file is found
- don't swallow an error bug log it
- only send 404 if res was not responded already

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
@akosyakov
Copy link
Member Author

@tsmaeder I've updated code with comments and mapping all other errors to 500.

@tsmaeder
Copy link
Contributor

@akosyakov thx, lgtm.

@akosyakov akosyakov requested a review from a team August 21, 2019 11:43
Copy link
Contributor

@vinokurig vinokurig left a comment

Choose a reason for hiding this comment

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

Tested with https://github.com/vinokurig/Test.git plugin. The plugin works as expected, no errors in the console

@akosyakov akosyakov merged commit 7406add into master Aug 21, 2019
@akosyakov akosyakov deleted the ak/plugin_file_not_found branch August 21, 2019 13:18
@akosyakov
Copy link
Member Author

@vinokurig please rebase your PR, i will test it then

@yeweiasia
Copy link
Contributor

@yeweiasia Could you check whether you can reproduce #5967 with this PR?

I synced the code with mater HEAD, It seems that all vscode plugin fail to start properly, I don't have much time to diagnose today, deep diagnostics can be provided this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plug-in system issues related to the plug-in system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants