getLLMErrorInfo (llm/errors.ts)

langfuse · packages/shared/src/server/llm/errors.ts · typescript · MIT
ai, security

eslint-disable @typescript-eslint/no-use-before-define */

// Source: https://github.com/langfuse/langfuse | License: MIT | Copyright 2023-2026 ClickHouse, Inc
// Provided via justclaw.it.com; keep this notice with the code.
/* eslint-disable @typescript-eslint/no-use-before-define */
import { AISDKError, APICallError, RetryError } from "ai";

const LLM_VALIDATION_ERROR_MARKER = Symbol.for(
  "langfuse.error.LLMValidationError",
);

export type LLMValidationErrorCode =
  | "invalid-connection"
  | "invalid-request"
  | "endpoint-unreachable"
  | "media-not-found";

/**
 * A deterministic validation failure owned by Langfuse, before or around the
 * provider call. Provider failures remain native AI SDK errors.
 */
export class LLMValidationError extends Error {
  private readonly [LLM_VALIDATION_ERROR_MARKER] = true;

  readonly code: LLMValidation

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key