-
Notifications
You must be signed in to change notification settings - Fork 122
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
should pybids more lenient or at least get a dedicated exception like NonCompliantBIDSError #473
Comments
I'm 👍 for a sensible set of exceptions.
That said, I'm pretty sure you can use |
Also +1 for a hierarchy of exceptions—feel free to open a PR! |
My thinking on this has changed some. I spent some time a while back looking into it, and it seems like people are split pretty much 50-50 on whether best practice is to implement custom exceptions for every package, or to avoid it like the plague unless there's some critical reason for it. I don't have a strong feeling one way or the other, but the tiebreaker is that it would involve a fair amount of work to decide on a hierarchy, implement it, and then sweep through the codebase and replace the generic exceptions. Unless someone wants to volunteer to take this on, I propose to close this. |
Actually, I'm just going to go ahead and close it, to feed my issue-decluttering roll. If someone wants to volunteer to take this on, they can re-open it. |
could you please show me some argumentation against "implementing custom exceptions"? note that here it was not really about "implementing" but rather "defining" as subclasses of base exceptions. I will now prep a basic PR to kick start the effort ;) |
@yarikoptic there are some reasonable arguments both ways here. But mainly I'm swayed by huge packages like numpy and pandas, which define very few custom exceptions, and largely rely on That said, as I said above, I'm fine adding them if you do the work, which you've started to in #615. I just worry that we'll now proceed to argue for hours over what to include/rename/remove, whereas I don't think having a |
ATM pybids immediately throws a generic ValueError if found contained derivatives dataset is not fully compliant:
But I wonder
NonCompliantBIDSError(ValueError)
andNonCompliantDerivativesBIDSError(NonCompliantBIDSError)
) which would be thrown here instead of a generic ValueError which makes it fragile to handle such cases programmaticallyThe text was updated successfully, but these errors were encountered: