Skip to content

[CHORE: BACKEND] Throw error on service methods and catch them in routes #197

@realChakrawarti

Description

@realChakrawarti

Description

Currently, error handling within service methods is inconsistent. To centralize error management and provide clearer feedback to users, we need to enforce a standard where service methods either return a successful result (string) or throw an Error object when an issue occurs.

This approach will allow us to:

  • Propagate errors up to the route level.
  • Centralize error logging and user messaging at the route handler.
  • Improve predictability for consumers of service methods.

Acceptance Criteria:

  • All service methods must explicitly throw an Error instance when an exception or operational error is encountered.
  • Service methods must return a string upon successful completion.
  • Route handlers must include try-catch blocks to gracefully handle errors thrown by service methods, logging them appropriately and providing a user-friendly message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend serviceschoreRecurring or housekeeping taskscodeUpdate to source codev1.12.0Release v1.12.0

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions