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

fix: explicit check for initializationOptions and add optional chaining #310

Merged
merged 4 commits into from
Jan 28, 2025

Conversation

suprajaven
Copy link
Contributor

Problem

Check related PRs #306 and #307
Prevent errors due to aws object being undefined and improve error handling in initialize method

Solution

  • Updating to use optional chaining
  • Adding a check and logging in case aws object is not set.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@suprajaven suprajaven requested a review from a team as a code owner January 28, 2025 14:46

return initializeResult
} catch (error) {
if (!params.initializationOptions?.aws) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this field optional in protocol? Check comments in the previous PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, updated PR.

@suprajaven suprajaven closed this Jan 28, 2025
@suprajaven suprajaven reopened this Jan 28, 2025
@francescoopiccoli francescoopiccoli self-requested a review January 28, 2025 15:19
@suprajaven suprajaven merged commit e97456d into main Jan 28, 2025
3 checks passed
@suprajaven suprajaven deleted the fix-28jan branch January 28, 2025 16:47

return initializeResult
} catch (error) {
this.lspConnection.console.log(

Choose a reason for hiding this comment

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

The mitigation change added in this PR is not mutually exclusive with the observability change that has now been removed. Why can't we keep the try/catch handling in place? This way if an unexpected error happens in the future, we will have more information at our disposal to help investigate the situation.

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.

4 participants