Skip to content

Harden API error handling and clean no-useless-catch #12

@sugan0tech

Description

@sugan0tech

Summary
Standardize API error handling and remove no-useless-catch by letting Axios errors map to a single ApiError path.

Context
In src/utils/api.ts:

  • handleApiError throws, but many call sites use return handleApiError(err), which is misleading and may confuse types/control flow.
  • Some try/catch blocks only rethrow, triggering no-useless-catch.

Tasks

  • Replace return handleApiError(err) with throw handleApiError(err) or just let the error bubble if no mapping is needed.
  • Remove try/catch wrappers that merely rethrow.
  • Align function signatures and docs: helpers throw ApiError on failure.
  • Audit callers to ensure errors are caught where UX shows toasts or error states.

Acceptance Criteria

  • npm run lint passes with no-useless-catch resolved.
  • Consistent, typed throw behavior across API helpers; no silent returns on failure.
  • Error toasts/messages still display meaningful content for users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions