Skip to content

Fix Error handling for ai command bar #30

@gajendraxdev

Description

@gajendraxdev

currently we just checking the error response key word using .include in src/components/terminal/AiCommandBar.tsx line 360...367

fix

  • set constant ( a structured error object ) instead of error being a string it looks like this
{
  "code": "AI_DISABLED",
  "message": "AI features have been disabled in your settings.",
  "provider": "ollama"
}

and frontend code look likke this

const classifyError = (err: AppError): ErrorKind => {
   if (err.code === 'AI_DISABLED') return 'disabled';
   if (err.code === 'AUTH_FAILED') return 'invalid-key';
   // No strings, no guesses!
   return 'generic';
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions