Commit 4d4b9b23 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

Allow disabling error patching for debugging

parent e0008a9e
...@@ -473,6 +473,10 @@ function sourceMapError( ...@@ -473,6 +473,10 @@ function sourceMapError(
export function patchErrorInspectNodeJS( export function patchErrorInspectNodeJS(
errorConstructor: ErrorConstructor errorConstructor: ErrorConstructor
): void { ): void {
if (process.env.NEXT_DISABLE_ERROR_PATCHING === '1') {
return
}
const inspectSymbol = Symbol.for('nodejs.util.inspect.custom') const inspectSymbol = Symbol.for('nodejs.util.inspect.custom')
errorConstructor.prepareStackTrace = prepareUnsourcemappedStackTrace errorConstructor.prepareStackTrace = prepareUnsourcemappedStackTrace
...@@ -513,6 +517,10 @@ export function patchErrorInspectNodeJS( ...@@ -513,6 +517,10 @@ export function patchErrorInspectNodeJS(
export function patchErrorInspectEdgeLite( export function patchErrorInspectEdgeLite(
errorConstructor: ErrorConstructor errorConstructor: ErrorConstructor
): void { ): void {
if (process.env.NEXT_DISABLE_ERROR_PATCHING === '1') {
return
}
const inspectSymbol = Symbol.for('edge-runtime.inspect.custom') const inspectSymbol = Symbol.for('edge-runtime.inspect.custom')
errorConstructor.prepareStackTrace = prepareUnsourcemappedStackTrace errorConstructor.prepareStackTrace = prepareUnsourcemappedStackTrace
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment