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

Avoid masking exceptions as cancellations in Workspace.open #17424

Merged
merged 1 commit into from May 29, 2018

Conversation

Projects
None yet
2 participants
@maxbrunsfeld
Contributor

maxbrunsfeld commented May 29, 2018

Previously, when opening a file via Workspace.open, if an exception was thrown by Project.bufferPath or TextEditorRegistry.build, the exception would be dropped, and we would instead throw a special error with the code CANCELLED, which instructs another code path in Workspace to silently halt.

This PR simplifies that Workspace method to avoid using a try block entirely, so that uncaught exceptions can be surfaced.

I believe this problem was introduced in #16229. It's generally not a big deal, because in most cases, the methods I mentioned above won't throw exceptions. @nathansobo noticed this bug when attempting to use an incompatible version of tree-sitter-rust. An exception is thrown when trying to use a parser whose ABI is incompatible with the current version of Tree-sitter.

@daviwil

Looks good to me!

@maxbrunsfeld maxbrunsfeld merged commit d7e7c77 into master May 29, 2018

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@maxbrunsfeld maxbrunsfeld deleted the mb-workspace-open-exception-handling branch May 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment