Skip to content

Commit

Permalink
feat!: always throw under development
Browse files Browse the repository at this point in the history
  • Loading branch information
infodusha committed May 17, 2024
1 parent 99a18ac commit 7b44d63
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/next-rsc-error-handler/inserted/capture.js
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
}

Expand Down

0 comments on commit 7b44d63

Please sign in to comment.