/opt/canhelp/node_modules/next/dist/next-devtools/userspace/app/errors
NameSizeModeActions
index.d.ts1740644editdlrm
index.js11930644editdlrm
index.js.map5070644editdlrm
intercept-console-error.d.ts1780644editdlrm
intercept-console-error.js29250644editdlrm
intercept-console-error.js.map30700644editdlrm
replay-ssr-only-errors.d.ts3200644editdlrm
replay-ssr-only-errors.js28220644editdlrm
replay-ssr-only-errors.js.map35010644editdlrm
stitched-error.d.ts3620644editdlrm
stitched-error.js21950644editdlrm
stitched-error.js.map18310644editdlrm
use-error-handler.d.ts3940644editdlrm
use-error-handler.js53500644editdlrm
use-error-handler.js.map72100644editdlrm
use-forward-console-log.d.ts1880644editdlrm
use-forward-console-log.js12140644editdlrm
use-forward-console-log.js.map13480644editdlrm
Edit: /opt/canhelp/node_modules/next/dist/next-devtools/userspace/app/errors/use-error-handler.js.map (7210B)
{"version":3,"sources":["../../../../../src/next-devtools/userspace/app/errors/use-error-handler.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { isNextRouterError } from '../../../../client/components/is-next-router-error'\nimport {\n formatConsoleArgs,\n parseConsoleArgs,\n} from '../../../../client/lib/console'\nimport isError from '../../../../lib/is-error'\nimport { createConsoleError } from '../../../shared/console-error'\nimport { coerceError, setOwnerStackIfAvailable } from './stitched-error'\nimport {\n forwardUnhandledError,\n isTerminalLoggingEnabled,\n logUnhandledRejection,\n} from '../forward-logs'\n\nconst queueMicroTask =\n globalThis.queueMicrotask || ((cb: () => void) => Promise.resolve().then(cb))\n\ntype ErrorHandler = (error: Error) => void\n\nconst errorQueue: Array = []\nconst errorHandlers: Array = []\nconst rejectionQueue: Array = []\nconst rejectionHandlers: Array = []\n\nexport function handleConsoleError(\n originError: unknown,\n consoleErrorArgs: any[]\n) {\n let error: Error\n const { environmentName } = parseConsoleArgs(consoleErrorArgs)\n if (isError(originError)) {\n error = createConsoleError(originError, environmentName)\n } else {\n error = createConsoleError(\n formatConsoleArgs(consoleErrorArgs),\n environmentName\n )\n }\n setOwnerStackIfAvailable(error)\n\n errorQueue.push(error)\n for (const handler of errorHandlers) {\n // Delayed the error being passed to React Dev Overlay,\n // avoid the state being synchronously updated in the component.\n queueMicroTask(() => {\n handler(error)\n })\n }\n}\n\nexport function handleClientError(error: Error) {\n errorQueue.push(error)\n for (const handler of errorHandlers) {\n // Delayed the error being passed to React Dev Overlay,\n // avoid the state being synchronously updated in the component.\n queueMicroTask(() => {\n handler(error)\n })\n }\n}\n\nexport function useErrorHandler(\n handleOnUnhandledError: ErrorHandler,\n handleOnUnhandledRejection: ErrorHandler\n) {\n useEffect(() => {\n // Handle queued errors.\n errorQueue.forEach(handleOnUnhandledError)\n rejectionQueue.forEach(handleOnUnhandledRejection)\n\n // Listen to new errors.\n errorHandlers.push(handleOnUnhandledError)\n rejectionHandlers.push(handleOnUnhandledRejection)\n\n return () => {\n // Remove listeners.\n errorHandlers.splice(errorHandlers.indexOf(handleOnUnhandledError), 1)\n rejectionHandlers.splice(\n rejectionHandlers.indexOf(handleOnUnhandledRejection),\n 1\n )\n\n // Reset error queues.\n errorQueue.splice(0, errorQueue.length)\n rejectionQueue.splice(0, rejectionQueue.length)\n }\n }, [handleOnUnhandledError, handleOnUnhandledRejection])\n}\n\nfunction onUnhandledError(event: WindowEventMap['error']): void | boolean {\n const thrownValue: unknown = event.error\n if (isNextRouterError(thrownValue)) {\n event.preventDefault()\n return false\n }\n // When there's an error property present, we log the error to error overlay.\n // Otherwise we don't do anything as it's not logging in the console either.\n if (thrownValue) {\n const error = coerceError(thrownValue)\n setOwnerStackIfAvailable(error)\n handleClientError(error)\n if (isTerminalLoggingEnabled) {\n forwardUnhandledError(error)\n }\n }\n}\n\nfunction onUnhandledRejection(ev: WindowEventMap['unhandledrejection']): void {\n const reason: unknown = ev?.reason\n if (isNextRouterError(reason)) {\n ev.preventDefault()\n return\n }\n\n const error = coerceError(reason)\n setOwnerStackIfAvailable(error)\n\n rejectionQueue.push(error)\n for (const handler of rejectionHandlers) {\n handler(error)\n }\n\n if (isTerminalLoggingEnabled) {\n logUnhandledRejection(reason)\n }\n}\n\nexport function handleGlobalErrors() {\n if (typeof window !== 'undefined') {\n try {\n // Increase the number of stack frames on the client\n Error.stackTraceLimit = 50\n } catch {}\n\n window.addEventListener('error', onUnhandledError)\n window.addEventListener('unhandledrejection', onUnhandledRejection)\n }\n}\n"],"names":["handleClientError","handleConsoleError","handleGlobalErrors","useErrorHandler","queueMicroTask","globalThis","queueMicrotask","cb","Promise","resolve","then","errorQueue","errorHandlers","rejectionQueue","rejectionHandlers","originError","consoleErrorArgs","error","environmentName","parseConsoleArgs","isError","createConsoleError","formatConsoleArgs","setOwnerStackIfAvailable","push","handler","handleOnUnhandledError","handleOnUnhandledRejection","useEffect","forEach","splice","indexOf","length","onUnhandledError","event","thrownValue","isNextRouterError","preventDefault","coerceError","isTerminalLoggingEnabled","forwardUnhandledError","onUnhandledRejection","ev","reason","logUnhandledRejection","window","Error","stackTraceLimit","addEventListener"],"mappings":";;;;;;;;;;;;;;;;;IAmDgBA,iBAAiB;eAAjBA;;IA1BAC,kBAAkB;eAAlBA;;IAuGAC,kBAAkB;eAAlBA;;IAlEAC,eAAe;eAAfA;;;;uBA9DU;mCACQ;yBAI3B;kEACa;8BACe;+BACmB;6BAK/C;AAEP,MAAMC,iBACJC,WAAWC,cAAc,IAAK,CAAA,CAACC,KAAmBC,QAAQC,OAAO,GAAGC,IAAI,CAACH,GAAE;AAI7E,MAAMI,aAA2B,EAAE;AACnC,MAAMC,gBAAqC,EAAE;AAC7C,MAAMC,iBAA+B,EAAE;AACvC,MAAMC,oBAAyC,EAAE;AAE1C,SAASb,mBACdc,WAAoB,EACpBC,gBAAuB;IAEvB,IAAIC;IACJ,MAAM,EAAEC,eAAe,EAAE,GAAGC,IAAAA,yBAAgB,EAACH;IAC7C,IAAII,IAAAA,gBAAO,EAACL,cAAc;QACxBE,QAAQI,IAAAA,gCAAkB,EAACN,aAAaG;IAC1C,OAAO;QACLD,QAAQI,IAAAA,gCAAkB,EACxBC,IA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