From 8f181b1b266b4f2fc31e508635f2f013d53913f1 Mon Sep 17 00:00:00 2001 From: Stan Wohlwend Date: Sun, 9 Jun 2024 18:26:33 +0200 Subject: [PATCH] Make ISE a common error --- .../src/route-handlers/smart-route-handler.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/stack-server/src/route-handlers/smart-route-handler.tsx b/packages/stack-server/src/route-handlers/smart-route-handler.tsx index 4ca3d664f..fdb153e85 100644 --- a/packages/stack-server/src/route-handlers/smart-route-handler.tsx +++ b/packages/stack-server/src/route-handlers/smart-route-handler.tsx @@ -10,11 +10,18 @@ import { runAsynchronously, wait } from "@stackframe/stack-shared/dist/utils/pro import { MergeSmartRequest, SmartRequest, createLazyRequestParser } from "./smart-request"; import { SmartResponse, createResponse } from "./smart-response"; +class InternalServerError extends StatusError { + constructor() { + super(StatusError.InternalServerError); + } +} + /** * Known errors that are common and should not be logged with their stacktrace. */ const commonErrors = [ KnownErrors.AccessTokenExpired, + InternalServerError, ]; /** @@ -34,7 +41,7 @@ function catchError(error: unknown): StatusError { if (error instanceof StatusError) return error; captureError(`route-handler`, error); - return new StatusError(StatusError.InternalServerError); + return new InternalServerError(); } /**