Enhance server side error handling (#4537)

* fix: server side error handling

* fix: push only unknown 500 errors to sentry

* fix: use in-house onerror in favor of errorHandling middleware

* fix: split error template into dev and prod envs

* fix: check Error instance

* fix: error routes in test env

* fix: review comments

* Remove koa-onerror

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Apoorv Mishra
2022-12-09 21:51:42 +05:30
committed by GitHub
parent 4f67437b81
commit 053d10d893
17 changed files with 319 additions and 78 deletions

View File

@@ -4,7 +4,6 @@ import Router from "koa-router";
import userAgent, { UserAgentContext } from "koa-useragent";
import env from "@server/env";
import { NotFoundError } from "@server/errors";
import errorHandling from "@server/middlewares/errorHandling";
import { defaultRateLimiter } from "@server/middlewares/rateLimiter";
import { AuthenticatedState } from "@server/types";
import apiKeys from "./apiKeys";
@@ -41,7 +40,6 @@ const api = new Koa<
const router = new Router();
// middlewares
api.use(errorHandling());
api.use(
bodyParser({
multipart: true,