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.

1018 B
Raw Blame
/**
 * Typed errors for signed-state decode failures. Callers (e.g. the
 * confirmed-action runtime) catch by class and map to user-facing messages.
 */

export abstract class SignedStateError extends Error {
    /** Short label suitable for metric/log fields. */
    abstract readonly kind: string
    constructor(message: string) {
        super(message)
        this.name = this.constructor.name
    }
}

export class SignedStateMalformed extends SignedStateError {
    readonly kind = 'malformed'
}
export class SignedStateSignatureInvalid extends SignedStateError {
    readonly kind = 'bad_signature'
}
export class SignedStateExpired extends SignedStateError {
    readonly kind = 'expired'
}
export class SignedStateUserMismatch extends SignedStateError {
    readonly kind = 'user_mismatch'
}
export class SignedStatePurposeMismatch extends SignedStateError {
    readonly kind = 'purpose_mismatch'
}
export class SignedStateAlreadyConsumed extends SignedStateError {
    readonly kind = 'already_consumed'
}