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

Use of bare 'except:' is bad #387

Open
willfurnass opened this issue Feb 14, 2020 · 1 comment
Open

Use of bare 'except:' is bad #387

willfurnass opened this issue Feb 14, 2020 · 1 comment
Labels

Comments

@willfurnass
Copy link
Collaborator

Bare except: statements will swallow up all exceptions, making debugging more difficult and possibly making certain code paths inaccessible. For example in views.py line 2887 can never be reached as the except: lines above will consume any raised ZeroDivisionErrors.

  2878                 try:              
  2879                     try:
  2880                         pyDScont['EQ' + str(EQ_iter)].backward()
  2881                     except:                          
  2882                         self._showErrorMessage('Continuation failure (backward) on initial branch<br>')
  2883                     try:
  2884                         pyDScont['EQ' + str(EQ_iter)].forward()
  2885                     except:
  2886                         self._showErrorMessage('Continuation failure (forward) on initial branch<br>')
  2887                 except ZeroDivisionError:
  2888                     self._show_computation_stop()
  2889                     self._showErrorMessage('Division by zero<br>')
@willfurnass
Copy link
Collaborator Author

Oh, and there are quite a few of these in the code - as of 65901da:

$ grep -R 'except:' mumot/ | wc -l
19

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

No branches or pull requests

1 participant