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: Handle gracefully when trying to detect invalid sketch name error and folder is missing on filesystem #1616

Merged
merged 3 commits into from
Nov 10, 2022

Conversation

kittaakos
Copy link
Contributor

Motivation

To fix missing Open Recent menu items in IDE2 when ~/arduinoIDE/recent-sketches.json contains non-existing sketches.

Change description

The PR consists of three noteworthy changes:

  • IDE2 gracefully handles ENOENT (No such file or directory) error when trying to detect if the NotFound error received from the CLI is an "invalid sketch name" error. See: #964 Prompt move when opening invalid sketch outside from IDE2 #1563.
  • Generalized ErrnoException(errno(3)) detection in IDE2.
  • Relaxed when IDE2 tries to detect the "invalid sketch name" error. IDE2 must access the filesystem to detect this error. From now on, the special error detection code must be explicitly requested by clients. This change does not affect IDE2's service APIs and recovery behavior. Still, for example, when populating the Open Recent menus, it does not matter if the missing sketch was deleted or (incorrectly) renamed by the user. Hence the special error detection code does not run.

Other information

Closes #1596

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)

@kittaakos kittaakos added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Nov 2, 2022
Akos Kitta added 3 commits November 2, 2022 16:38
gracefully handle when sketch folder has been deleted

Closes #1596

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
The invalid sketch name detection requires at least one extra FS access.
Do not try to detect invalid sketch name error,
but use the original `NotFound` from the CLI.

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

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

I verified this fixes #1596 on Windows and Linux.

Thanks Akos!

Copy link
Contributor

@AlbyIanna AlbyIanna left a comment

Choose a reason for hiding this comment

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

code looks great to me

@kittaakos kittaakos merged commit 6984c52 into main Nov 10, 2022
@kittaakos kittaakos deleted the #1596 branch November 10, 2022 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Open Recent" menu missing after recent sketch is deleted
3 participants