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

UnphysicalSolution exception #8

Open
IanHawke opened this issue Nov 28, 2018 · 1 comment
Open

UnphysicalSolution exception #8

IanHawke opened this issue Nov 28, 2018 · 1 comment

Comments

@IanHawke
Copy link
Collaborator

A few thoughts:

  1. I have seen suggestions that custom exceptions should be defined in their own file, to make importing them easier. Certainly from r3d2.wave import UnphysicalSolution is not the most obvious, when playing with try/except tricks. However, I don't know how "fixed" this convention is.
  2. Would it be more consistent to have UnphysicalSolutionError to match other exceptions?
@jcmuddle
Copy link

jcmuddle commented Nov 28, 2018

Hi both, I hope you don’t mind me giving my two cents.

On Ian’s points:

I would say that 1 is not fixed but it is something I’ve been encouraging in my team as a good practice. I think it depends on the generality of the exception. If it will be raised across many files, I would move it to an exceptions file. If it is very specific and probably only going to raised in one file, then that is probably it’s home. UnphysicalSolution probably falls into the first category as I suspect there are many places in your code where an unphysical solution may occur.

On 2, I would agree that a naming convention is useful. I tend to do something like AppropriateNameException but it seems that AppropriateNameError would be more consistent in this case.

Hope you’re both well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants