Problem
The vouching service (lines 51, 78, 147, 165, 184) throws new Error(...) instead of NestJS HTTP exceptions like new InternalServerErrorException(...). These will result in unformatted 500 responses with no structured error code.
User impact: API clients receive inconsistent error formats (plain text 500 vs structured JSON).
Root Cause
Error handling was not updated to use NestJS patterns.
What To Build
- Replace all
new Error(...) with appropriate NestJS HTTP exceptions
- Use
NotFoundException, BadRequestException, InternalServerErrorException as appropriate
- Verify same issue in
vendors.service.ts (line 63)
Files To Touch
src/modules/vouching/vouching.service.ts — fix error handling
src/modules/vendors/vendors.service.ts — line 63 fix error handling
Acceptance Criteria
Mandatory Checks
Problem
The vouching service (lines 51, 78, 147, 165, 184) throws
new Error(...)instead of NestJS HTTP exceptions likenew InternalServerErrorException(...). These will result in unformatted 500 responses with no structured error code.User impact: API clients receive inconsistent error formats (plain text 500 vs structured JSON).
Root Cause
Error handling was not updated to use NestJS patterns.
What To Build
new Error(...)with appropriate NestJS HTTP exceptionsNotFoundException,BadRequestException,InternalServerErrorExceptionas appropriatevendors.service.ts(line 63)Files To Touch
src/modules/vouching/vouching.service.ts— fix error handlingsrc/modules/vendors/vendors.service.ts— line 63 fix error handlingAcceptance Criteria
Mandatory Checks