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

[FEATURE] Refactor LoadFileException into brainglobe-utils #180

Closed
Tracked by #67
willGraham01 opened this issue Feb 9, 2024 · 3 comments
Closed
Tracked by #67

[FEATURE] Refactor LoadFileException into brainglobe-utils #180

willGraham01 opened this issue Feb 9, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@willGraham01
Copy link
Contributor

The LoadFileException class is already defined as a stub in brainglobe-utils.image_io (versions 0.4.0 or above), and in brainreg.core.exceptions here as a fuller class.

We should refactor this expanded class into brainglobe-utils, and import it in brainreg.

@willGraham01 willGraham01 added bug Something isn't working good first issue Good for newcomers labels Feb 9, 2024
@willGraham01 willGraham01 changed the title [BUG] Refactor LoadFileException into brainglobe-utils [FEATURE] Refactor LoadFileException into brainglobe-utils Feb 9, 2024
@willGraham01 willGraham01 added enhancement New feature or request and removed bug Something isn't working labels Feb 9, 2024
@K-Meech K-Meech self-assigned this Mar 18, 2024
@K-Meech
Copy link
Contributor

K-Meech commented Mar 18, 2024

I can look into this issue. Just to double check - the aim would be to replace ImageIOLoadException from brainglobe-utils with LoadFileException from brainreg?

@willGraham01
Copy link
Contributor Author

Yeah - if you look at brainreg.core.main you'll see that LoadFileException is thrown after obtaining an error from brainglobe-utils.image_io.load.load_any.

The error thrown by load_any is of type ImageIOLoadException, which doesn't really do anything in terms of offering extra information. It would be better to move what's currently in LoadFileException into ImageIOLoadException, so that the load_img_stack function could then raise this error directly, saving us the try/catch block that we currently have in brainreg.core.main.

LoadFileExcaption also currently takes a error_type argument to __init__, so we can potentially add cases to this in brainglobe-utils to cover other occasions where we throw an error on loading. EG Here we could raise a LoadFileException(error_type="memory") for example.

@K-Meech
Copy link
Contributor

K-Meech commented Mar 26, 2024

Closing this issue, as all refactoring is now done + released.

@K-Meech K-Meech closed this as completed Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants