All files / apps/web/src/utils sentry.ts

100% Statements 5/5
50% Branches 1/2
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19        332x 23x   23x           23x     23x    
import * as Sentry from "@sentry/tanstackstart-react";
 
import type { GetLinksOptions } from "~app/utils/trpc";
 
export const captureSentryError: GetLinksOptions["captureError"] = (error) => {
	const transactionId = Math.random().toString(36).slice(2, 9);
	// oxlint-disable-next-line no-console
	console.error(
		"Error occurred:",
		error,
		...(import.meta.env.MODE === "test" ? [error.message, error.stack] : []),
		transactionId,
	);
	Sentry.captureException(error, {
		tags: { transaction_id: transactionId },
	});
	return transactionId;
};