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.

798 B
Raw Blame
import { isDeterministicClientError } from 'lib/utils/requests'

describe('isDeterministicClientError', () => {
    // A dashboard tile's failed query is retried unless this returns true, so the status boundary
    // here is what stops a deterministic 400 from being hammered several times before it surfaces.
    it.each([
        [400, true],
        [401, true],
        [403, true],
        [404, true],
        [422, true],
        // transient 4xx that can succeed on retry
        [408, false],
        [429, false],
        // server / network errors are retryable
        [500, false],
        [503, false],
        [504, false],
        [undefined, false],
    ])('status %s -> %s', (status, expected) => {
        expect(isDeterministicClientError({ status })).toBe(expected)
    })
})