(NC-194) Log exceptions caught by middleware

Log exceptions caught in middleware at the WARN level. This adds a small
helper function that also logs the request method and URI. All the middleware
wrappers are moved into a single composed wrapper in middleware, so that it's
possible to independently test the full middleware stack and know it's the
same used on the real app.