Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make autoloading more robust to bad yaml files #114

Merged
merged 2 commits into from
Nov 12, 2024
Merged

Conversation

jni
Copy link
Member

@jni jni commented Nov 11, 2024

Having an incorrect yaml file in the default paths (root dir and config dir)
can cause the plugin to crash completely. I ran into this in #104, which was
particularly bad because the plugin wrote the inconsistent file in the first
place. However, there's many reasons why bad yaml might exist in the
default directories, including:

  • user incorrectly edits a file
  • the schema changes
  • valid action IDs change
  • the version of the plugin changes (schema and paths aren't pinned to
    versions)

Non-yaml files are already ignored, so I don't think it's a big difference if
we also ignore invalid yaml files. Until we provide utilities to clean up the
directories, I think robustness to bad input is very important.

In this PR, if we encounter any error while loading all models from given
directories, we ignore the error and move on to the next file.

@jni jni merged commit d1331e5 into napari:main Nov 12, 2024
10 checks passed
@jni jni deleted the robust-load branch November 12, 2024 23:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants