Fix error propagation: surface API validation messages in the UI #28

Closed
opened 2026-05-28 06:36:16 +00:00 by gelu · 1 comment
Owner

What

End-to-end fix for error propagation. Business-rule validation exceptions are swallowed at two points before they reach the browser, the global exception handler uses an inconsistent response shape, and the frontend never reads the error body.

Why

The user sees a generic message like 'Job matching failed' even when the API has a specific, actionable reason such as 'Could not extract enough job text. Paste the job description manually.'

Changes

  • UseJsonExceptionHandler: InvalidOperationException -> 400 with ex.Message; others -> 500. Use ErrorResponse consistently.
  • ErrorResponse: remove orphaned Score property.
  • CvMatcherController: catch Refit.ApiException for 4xx and forward upstream error body instead of generic 502.
  • main.js: read response body on failure in all forms; show server message for 4xx, generic fallback for 5xx.

Success criteria

  • 0 build errors/warnings
  • Invalid job URL shows 'Invalid job URL.' in the browser
  • Genuine 500 still shows generic fallback
  • ErrorResponse has no Score field

Time tracking

Started: 2026-05-28 09:36 UTC

## What End-to-end fix for error propagation. Business-rule validation exceptions are swallowed at two points before they reach the browser, the global exception handler uses an inconsistent response shape, and the frontend never reads the error body. ## Why The user sees a generic message like 'Job matching failed' even when the API has a specific, actionable reason such as 'Could not extract enough job text. Paste the job description manually.' ## Changes - UseJsonExceptionHandler: InvalidOperationException -> 400 with ex.Message; others -> 500. Use ErrorResponse consistently. - ErrorResponse: remove orphaned Score property. - CvMatcherController: catch Refit.ApiException for 4xx and forward upstream error body instead of generic 502. - main.js: read response body on failure in all forms; show server message for 4xx, generic fallback for 5xx. ## Success criteria - 0 build errors/warnings - Invalid job URL shows 'Invalid job URL.' in the browser - Genuine 500 still shows generic fallback - ErrorResponse has no Score field ## Time tracking Started: 2026-05-28 09:36 UTC
gelu closed this issue 2026-05-28 06:43:25 +00:00
Author
Owner

Merged via PR #29. All four failure handlers (CV upload, CV match, contact form, subscribe form) now surface upstream 4xx error messages from the server. Completed: 2026-05-28.

Merged via PR #29. All four failure handlers (CV upload, CV match, contact form, subscribe form) now surface upstream 4xx error messages from the server. Completed: 2026-05-28.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: AI/myAi#28