From 7b44d6373a610053753e890d53c5762462541520 Mon Sep 17 00:00:00 2001 From: infodusha Date: Fri, 17 May 2024 13:03:30 +0300 Subject: [PATCH] feat!: always throw under development --- packages/next-rsc-error-handler/inserted/capture.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/next-rsc-error-handler/inserted/capture.js b/packages/next-rsc-error-handler/inserted/capture.js index a08f6e4..7350d72 100644 --- a/packages/next-rsc-error-handler/inserted/capture.js +++ b/packages/next-rsc-error-handler/inserted/capture.js @@ -1,7 +1,4 @@ -import { - PHASE_PRODUCTION_BUILD, - PHASE_DEVELOPMENT_SERVER, -} from "next/constants"; +import { PHASE_PRODUCTION_BUILD } from "next/constants"; import { default as globalHandler } from "/global-server-error"; import { isRedirectError } from "next/dist/client/components/redirect"; import { isNotFoundError } from "next/dist/client/components/not-found"; @@ -15,12 +12,9 @@ export async function capture(error, ctx) { throw error; } - const result = globalHandler(error, ctx); + const result = await globalHandler(error, ctx); - if ( - result !== undefined && - process.env.NEXT_PHASE !== PHASE_DEVELOPMENT_SERVER - ) { + if (result !== undefined && process.env.NODE_ENV !== "development") { return result; }