4

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)?
elfeck
  • 385
  • 1
  • 8
  • Please keep it to one question at a time. –  Apr 12 '20 at 16:47
  • Well I can formulate this as a single question but I thought answering it may be easier being split up in small fragments. Should I make three separate posts with all this preamble or what? – elfeck Apr 12 '20 at 16:48

0 Answers0