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

Avoid uninteresting user facing errors #706

Merged
merged 2 commits into from
Dec 15, 2020

Conversation

aeisenberg
Copy link
Contributor

@aeisenberg aeisenberg commented Dec 14, 2020

This change avoids popping up error messages in two cases:

  1. When doing test discovery, do not run discovery on non-existant
    directories. Also, if there is an error, print to the log, and do not
    pop up an error window. The reason is that test discovery is a
    background operation and these should not normally cause pop-ups.
  2. When looking for orphaned databases, don't pop up an error if the
    storagePath can't be found. This is normal when working in a new,
    single root workspace.

Fixes #695

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [n/a] @github/docs-content-dsp has been cc'd in all issues for UI or other user-facing changes made by this pull request.

@aeisenberg aeisenberg added the Complexity: Low A good task for newcomers to learn, or experienced team members to complete quickly. label Dec 14, 2020
Copy link
Contributor

@adityasharad adityasharad left a comment

Choose a reason for hiding this comment

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

Nice!

// remove non-databases
dbDirs = await asyncFilter(dbDirs, isLikelyDatabaseRoot);
} catch (e) {
logger.log(`Not able to find the storage path '${e.message}'. Ignoring request to remove orphaned database directories.`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: You could do a check up front with await fs.exists(this.storagePath) so that we can distinguish between the storage path not existing, and some other failure to read its contents.

Suggested change
logger.log(`Not able to find the storage path '${e.message}'. Ignoring request to remove orphaned database directories.`);
logger.log(`Not able to read from the storage path '${e.message}'. Ignoring request to remove orphaned database directories.`);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me do that and fix it up a bit more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. I removed the try/catch around collecting the dbDirs since if there is an error at this point, that indicates something much stranger going on that might actually be important for the user.

This change avoids popping up error messages in two cases:

1. When doing test discovery, do not run discovery on non-existant
   directories. Also, if there is an error, print to the log, and do not
   pop up an error window. The reason is that test discovery is a
   background operation and these should not normally cause pop-ups.
2. When looking for orphaned databases, don't pop up an error if the
   storagePath can't be found. This is normal when working in a new,
   single root workspace.
!(await fs.pathExists(this.storagePath) ||
!(await fs.stat(this.storagePath)).isDirectory())
) {
// ignore a missing or invalid storage directory.
Copy link
Contributor

Choose a reason for hiding this comment

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

You had a log message for this before, I suggest keeping that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

When directory is not present.
@aeisenberg aeisenberg merged commit ca9510c into github:main Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Low A good task for newcomers to learn, or experienced team members to complete quickly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test discovery throws error when a workspace folder path is invalid
2 participants