Skip to content

💡 Improve error handling: use safe extraction of error messages (avoid 'any') #46

Description

@morningstarxcdcode

�� Description\nSeveral catch blocks use (e.g., ) and directly access or , which is unsafe when the thrown value is not an Error instance. This can lead to runtime crashes when third-party libraries throw non-Error values.\n\n---\n\n## 🔄 Steps to Reproduce\n1. Cause an endpoint to throw a non-Error (e.g., a string or plain object)\n2. Observe access to causing unexpected behavior or an unhelpful message.\n\n---\n\n## ✅ Expected Behavior\nUse for caught errors and a small helper (e.g., ) to safely extract a string message. Use type guards when accessing properties like .\n\n---\n\n## ✅ Fix / Recommendation\nAdd with and update places to use it + change to . I will open a PR applying this to Ollama utils/service as a first step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions