You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue [Refactor] Remove manual try/catch from uploadShipmentProof controller
Tier: 🟢 Easy
Description:
Problem:src/modules/shipments/shipments.controller.ts lines 76-98 wrap the uploadShipmentProof handler in a manual try/catch block that catches all errors and returns a generic 500 response. Per AGENTS.md convention, controllers must NOT use manual try/catch — they should be wrapped in asyncHandler and throw AppError instances, letting the global error middleware handle formatting and status codes. The current approach swallows meaningful error messages and returns unhelpful "Failed to upload proof" responses for all failure modes.
Implementation: Remove the try/catch block. Wrap the route handler with asyncHandler in the route definition (if not already). Let the service layer throw typed AppError instances that the global error middleware will format consistently.
Dependencies:
Depends on issue-43.md (duplicate sendResponse must be fixed first)
Acceptance Criteria:
uploadShipmentProof controller has no manual try/catch.
Domain: Shipments
Issue [Refactor] Remove manual try/catch from
uploadShipmentProofcontrollerTier: 🟢 Easy
Description:
src/modules/shipments/shipments.controller.tslines 76-98 wrap theuploadShipmentProofhandler in a manualtry/catchblock that catches all errors and returns a generic 500 response. Per AGENTS.md convention, controllers must NOT use manualtry/catch— they should be wrapped inasyncHandlerand throwAppErrorinstances, letting the global error middleware handle formatting and status codes. The current approach swallows meaningful error messages and returns unhelpful "Failed to upload proof" responses for all failure modes.try/catchblock. Wrap the route handler withasyncHandlerin the route definition (if not already). Let the service layer throw typedAppErrorinstances that the global error middleware will format consistently.Dependencies:
Acceptance Criteria:
uploadShipmentProofcontroller has no manualtry/catch.asyncHandler(uploadShipmentProof)wrapper.AppErrorwith correct status codes.Testing Requirements:
deliveryProof.test.tsto confirm proper error responses.PR Checklist:
refactor/issue-44-remove-trycatch-proof-upload).npm run lintandnpm run buildpass with zero warnings.