bcgov / bcgov/SIMS

BUG: Existing draft application validation is logged as unhandled

Open
#6,579 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
29
Forks
15
Avg merge
1d 13h
Merged PRs (30d)
40

Description

**Describe the Bug**

Creating a draft when the student already has one returns 422 and is emitted as an unhandled exception.

**Expected Behaviour**

The existing-draft condition is handled as an expected client response with useful navigation or feedback and without a misleading unhandled-exception error log.

**Actual Behaviour**

`createDraftApplication` throws `UnprocessableEntityException`, which `AppAllExceptionsFilter` records as unhandled.

**Related Issue**

#3557 tracks improving the user flow when an application is already in progress. This report captures the production API logging behavior.

**Log**

```text
[Nest] 18 - 09/04/2026, 7:06:24 AM LOG [AccessLoggerMiddleware] Request - POST /api/students/application/draft From [redacted] | User GUID: [redacted] | User Agent: Firefox 148 on macOS
[Nest] 18 - 09/04/2026, 7:06:24 AM ERROR [AppAllExceptionsFilter] Unhandled exception, request path: /api/students/application/draft
{
"stack": "UnprocessableEntityException: There is already an existing draft application associated with the current student.\n at ApplicationStudentsController.createDraftApplication (webpack://studentaid-backend/apps/api/src/route-controllers/application/application.students.controller.ts:474:15)",
"response": { "message": "There is already an existing draft application associated with the current student." },
"status": 422,
"message": "There is already an existing draft application associated with the current student.",
"name": "UnprocessableEntityException"
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in apps/api/src/route-controllers/application/application.students.controller.ts around createDraftApplication and trace how AppAllExceptionsFilter handles the resulting 422. Reproduce the existing-draft request and verify the client response remains useful while the expected condition is no longer recorded as an unhandled exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.