Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

616 B
Raw Blame
/** What a log may keep of a failure: an error's message can echo query text, filters or connection details. */
export interface SafeErrorFields {
  errName: string;
  errCode: string | number | null;
}

/** The failure's name and driver code, never its message or stack. */
export function getSafeErrorFields(error: unknown): SafeErrorFields {
  const code =
    error != null && typeof error === 'object' ? (error as { code?: unknown }).code : null;
  return {
    errName: error instanceof Error ? error.name : typeof error,
    errCode: typeof code === 'string' || typeof code === 'number' ? code : null,
  };
}