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: retry compilation if grpc client needs to be reinitialized #2548

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

Conversation

giacomocusinato
Copy link
Collaborator

@giacomocusinato giacomocusinato commented Oct 30, 2024

Motivation

Closes: #2547

Change description

Catch invalid instance error during compilation, refresh grpc client and retry.

Other information

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

This change resolves the issue where the intersection of `ServiceError` error codes of type `number` resulted in the `never` type due to conflict between number and `State` enum if `StatusObject`
@per1234 per1234 linked an issue Oct 30, 2024 that may be closed by this pull request
3 tasks
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself topic: CLI Related to Arduino CLI labels Oct 30, 2024
Copy link
Contributor

@dankeboy36 dankeboy36 left a comment

Choose a reason for hiding this comment

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

It's looking great.

Why not handle the error on the backend without sending it back to the FE? Is there a technical limitation? Thank you! (Related #2500)


if (
ServiceError.isInvalidArgument(error) &&
error.details.includes('instance is no longer valid')
Copy link
Contributor

Choose a reason for hiding this comment

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

What should happen when the selected language is, for example, German, and there is a translation for this error message for the CLI?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm now extracting the error type from the error metadata 👍

@giacomocusinato
Copy link
Collaborator Author

Thanks for the review @dankeboy36!
You're right, would be best to handle the error directly on the backend. Initially I found a bit confusing code-wise restarting the compile stream in the same method, but I've proposed a solution now. If that works I might use the same approach with the logic in #2500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to Arduino CLI topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modification of installed core files breaks compilation
3 participants