···22 * All route handler functions extracted for reuse
33 */
4455-import * as Sentry from "@sentry/bun";
65// These will be injected by the route system
76import type { SlackCache } from "../cache";
87import type { RouteHandlerWithAnalytics } from "../lib/analytics-wrapper";
···8281 recordAnalytics(404);
8382 return Response.json({ message: "User not found" }, { status: 404 });
8483 }
8585-8686- Sentry.withScope((scope) => {
8787- scope.setExtra("url", request.url);
8888- scope.setExtra("user", userId);
8989- Sentry.captureException(e);
9090- });
91849285 recordAnalytics(500);
9386 return Response.json(
-14
src/index.ts
···11-import * as Sentry from "@sentry/bun";
21import { serve } from "bun";
32import { getEmojiUrl } from "../utils/emojiHelper";
43import { SlackCache } from "./cache";
···76import { createApiRoutes } from "./routes/api-routes";
87import { SlackWrapper } from "./slackWrapper";
98import swagger from "./swagger.html";
1010-1111-// Initialize Sentry if DSN is provided
1212-if (process.env.SENTRY_DSN) {
1313- console.log("Sentry DSN provided, error monitoring is enabled");
1414- Sentry.init({
1515- environment: process.env.NODE_ENV,
1616- dsn: process.env.SENTRY_DSN,
1717- tracesSampleRate: 0.5,
1818- ignoreErrors: ["Not Found", "404", "user_not_found", "emoji_not_found"],
1919- });
2020-} else {
2121- console.warn("Sentry DSN not provided, error monitoring is disabled");
2222-}
2392410// Initialize SlackWrapper and Cache
2511const slackApp = new SlackWrapper();