observability: backend-agnostic error-capture seam (Phase 1, inert until SENTRY_DSN)

This commit is contained in:
Moheeb Zara
2026-05-21 17:00:37 -07:00
parent 95f79771ec
commit c89e4d95e1
12 changed files with 434 additions and 5 deletions
+9
View File
@@ -11,6 +11,7 @@
// unique index makes duplicate enqueues a no-op via ignoreDuplicates.
import type { createAdminClient } from '@/lib/supabase/admin'
import { captureException } from '@/lib/observability/capture'
type AdminClient = ReturnType<typeof createAdminClient>
@@ -87,12 +88,20 @@ export async function enqueueNotification(
)
if (error) {
console.error(`[notifications] enqueue ${params.type} failed:`, error.message)
captureException(error, {
surface: 'notifications/enqueue',
tags: { space: params.spaceId, type: params.type },
})
}
} catch (e) {
console.error(
`[notifications] enqueue ${params.type} threw:`,
e instanceof Error ? e.message : e,
)
captureException(e, {
surface: 'notifications/enqueue',
tags: { space: params.spaceId, type: params.type, stage: 'throw' },
})
}
}