@sentry/nextjs
Version:
Official Sentry SDK for Next.js
37 lines (33 loc) • 1.23 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const core = require('@sentry/core');
const nextNavigationErrorUtils = require('./nextNavigationErrorUtils.js');
const responseEnd = require('./utils/responseEnd.js');
function captureRequestError(error, request, errorContext) {
if (nextNavigationErrorUtils.isPrerenderControlFlowError(error)) {
return;
}
core.withScope((scope) => {
scope.setSDKProcessingMetadata({
normalizedRequest: {
headers: core.headersToDict(request.headers),
method: request.method
}
});
scope.setContext("nextjs", {
request_path: core.filterCollectedUrl(request.path, scope.getClient()),
router_kind: errorContext.routerKind,
router_path: errorContext.routePath,
route_type: errorContext.routeType
});
scope.setTransactionName(`${request.method} ${errorContext.routePath}`);
core.captureException(error, {
mechanism: {
handled: false,
type: "auto.function.nextjs.on_request_error"
}
});
responseEnd.waitUntil(responseEnd.flushSafelyWithTimeout());
});
}
exports.captureRequestError = captureRequestError;
//# sourceMappingURL=captureRequestError.js.map