Warp/WAI Internal Exception Handling

190 Views Asked by At

I am developing a Warp / WarpTLS application and a bunch of middleware (without yesod), all of which handles its own exceptions.

Currently I want to deal with Exceptions raised within Warp and WarpTLS and I am unclear about what exceptions can occur and if a handler provided to setOnException is sufficient to handle all exceptions (including TLS exceptions for instance).

Here is what I understand:

  1. setOnException can be used to catch warp-internal exceptions (as well as application exceptions) according to the doc
  2. Warp exposes InvalidRequest with an Exception instance.
  3. Inspecting the src of defaultOnExceptionResponse suggests that ConnectionError may be raised from within Warp.

My questions:

  1. If I provide a handler to setOnException can I be sure all internal exceptions will end up there?
  2. Does 1) hold true even if I use WarpTLS and runTLS?
  3. What kind of exceptions may be thrown by runSettings (Warp) and runTLS (WarpTLS)?
0

There are 0 best solutions below