Fastapi exception handler middleware.