Catch most errors from WSGI app and re-raise as a different exception type

The reason to use a different error is to avoid handling inside client
code, e.g. requests.get(), which may silence it.
Add test for behavior when WSGI app generates an error