ianthetechie / SwiftCGI

An object-functional microframework for developing FCGI applications in Swift
Other
97 stars 11 forks source link

Adopt proper Swift exception handling #16

Open ianthetechie opened 9 years ago

ianthetechie commented 9 years ago

Swift does not yet support exception handling, but when it does, the main request/response handler block, including all of the wares (pre, middle, and post) should be wrapped in a giant exception handler that returns a 500 response if something goes wrong.

ianthetechie commented 8 years ago

Now that the details are in... many usages of fatalError should now be replaced with a swift-style exception and caught in a logical place. fatalError should only be used in cases of programmer error. Otherwise, we generally want our server to be able to recover and continue handling requests.