Catching Errors with Middleware