Skip to content

Unhandled Exceptions and Inadequate Error Handling in ViewModels #1

@Leizpig

Description

@Leizpig

Several ViewModel methods (e.g., ChatViewModel.sendContent, ChatViewModel.retryMessage) use require statements and only print stack traces in their coroutine exception handlers. This can cause the app to crash or fail silently without user feedback if an exception occurs.

Steps to Reproduce

  • Trigger an exception in a ViewModel coroutine (e.g., by providing invalid input or causing a network failure).
  • Observe that the exception is only printed and not handled gracefully.

Expected Behavior

  • Exceptions should be caught and handled with user-friendly error messages or UI feedback, not just logged or printed.

Suggested Fix

  • Implement robust error handling and user notifications in all ViewModel coroutine scopes.
  • Consider using a shared exception handler with UI feedback mechanisms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions