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

Better exception handling #312

Closed
15 of 19 tasks
subhankarb opened this issue Mar 30, 2017 · 2 comments
Closed
15 of 19 tasks

Better exception handling #312

subhankarb opened this issue Mar 30, 2017 · 2 comments

Comments

@subhankarb
Copy link
Contributor

subhankarb commented Mar 30, 2017

We have very generic exception and in some places we are even swallowing them.

Acceptance criteria

  • No exceptions swallowed silently
  • Specific exceptions were possible

Tasks

  • Got through code base and list out all exceptions that are silently swallowed
  • Use specific exception in app/init.py
  • Change tests.

Analysis

swallowing exceptions

Generic exceptions

Other comments

More specific exception handling, general Exception is always bad, should be specific type of exception.

On the above two points, and an earlier one - If we handle Exception and return False, especially on operations such as reading, writing and deleting user data, we have a real problem waiting to appear in unexpected ways.

This seems like a bad place to silently swallow an exception:

@subhankarb subhankarb self-assigned this Mar 30, 2017
@subhankarb subhankarb added this to the Sprint - 10 Apr 2017 milestone Mar 30, 2017
@pwalsh pwalsh mentioned this issue Mar 30, 2017
24 tasks
@subhankarb subhankarb changed the title Proper exception handling Better exception handling Apr 1, 2017
@rufuspollock rufuspollock assigned zelima and unassigned subhankarb Apr 8, 2017
@rufuspollock
Copy link
Contributor

@zelima one comment - i don't mind using generic exception object Exception as long as we have a good message (trying to create specific types of exception as classes is usually pointless at this stage -- it only matters if you are later trying to catch only a specific type of exception).

zelima added a commit that referenced this issue Apr 28, 2017
zelima added a commit that referenced this issue Apr 28, 2017
zelima added a commit that referenced this issue May 3, 2017
…classand registered at top level with hanlders for 400, 401, 404 adn 500 - refs #312
zelima added a commit that referenced this issue May 3, 2017
- controllers refactored to handle internal server errors without try/catch
- new tests, as previous ones were not full covering all cases
- tests refactored to assert new error messages
@zelima
Copy link
Contributor

zelima commented May 3, 2017

FIXED

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

3 participants