Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

642 B
Raw Blame
import { ApiError, apiJson } from '@/api/client'

import type { TaskLookup } from './notificationRouting'

interface TaskReportApi {
    signal_report?: string | null
}

export async function findTask(projectId: number, taskId: string): Promise<TaskLookup> {
    try {
        const task = await apiJson<TaskReportApi>(`/api/projects/${projectId}/tasks/${encodeURIComponent(taskId)}/`)
        return { found: true, reportId: task.signal_report ?? null }
    } catch (error) {
        if (error instanceof ApiError && (error.status === 404 || error.status === 403)) {
            return { found: false }
        }
        throw error
    }
}