Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improve tracebacks on exceptions #2705

Merged
merged 1 commit into from
Nov 27, 2017
Merged

Improve tracebacks on exceptions #2705

merged 1 commit into from
Nov 27, 2017

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Nov 23, 2017

Use addErrback rather than try/catch to handle exceptions thrown by request
handlers, which improves the tracebacks.

@erikjohnston
Copy link
Member

Is there a reason to do it like this rather than to try using the twisted logger?

@richvdh
Copy link
Member Author

richvdh commented Nov 23, 2017

Good question. I failed to realise that was a thing that would help.

I'm not super-keen on using the twisted logger per se, because it means that we lose log categories etc. Nevertheless, it turns out that we can do what the twisted logger does to recover the original Failure, and
get the best of both worlds.

Use failure.Failure to recover our failure, which will give us a useful
stacktrace, unlike the rethrown exception.
@richvdh richvdh force-pushed the rav/improve_tracebacks branch from 5abbf77 to 6be01f5 Compare November 27, 2017 12:07
@richvdh richvdh merged commit 96387bd into develop Nov 27, 2017
@richvdh richvdh mentioned this pull request Nov 27, 2017
@richvdh richvdh deleted the rav/improve_tracebacks branch November 29, 2017 16:03
@ara4n
Copy link
Member

ara4n commented May 3, 2018

the other significant advantage of the twisted logger aiui is that it never blocks?

@richvdh
Copy link
Member Author

richvdh commented May 3, 2018

that's #1727, and as I said there, there are other solutions to that problem.

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

Successfully merging this pull request may close these issues.

3 participants