Skip to content

fix: standardize error response format to { message } across all endpoints#183

Open
jakebromberg wants to merge 2 commits intomainfrom
fix/26-error-format-consistency
Open

fix: standardize error response format to { message } across all endpoints#183
jakebromberg wants to merge 2 commits intomainfrom
fix/26-error-format-consistency

Conversation

@jakebromberg
Copy link
Member

Summary

  • errorHandler.ts: Non-WxycError errors no longer leak raw error.message to clients — they now return { message: 'Internal server error' } and log the real error via console.error
  • library/flowsheet/djs controllers: Replaced all res.send('plain string') calls with res.json({ message: '...' }) and removed the extra status field from { status, message } response objects
  • New test suite at tests/unit/middleware/errorHandler.test.ts covering both WxycError and non-WxycError paths

Test plan

  • Unit tests verify WxycError returns { message } with correct status code
  • Unit tests verify non-WxycError returns generic { message: 'Internal server error' } (previously leaked raw message)
  • Unit tests verify non-Error thrown values are handled
  • Unit tests verify console.error is called for unhandled errors
  • Full unit test suite passes (124 tests, 9 suites)

Made with Cursor

…oints

Mixed formats (plain strings, { status, message }, leaked error.message)
are now consistently { message: '...' }. Internal errors no longer
expose raw error messages to clients.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jakebromberg jakebromberg force-pushed the fix/26-error-format-consistency branch from fb9e3a8 to 813682f Compare February 27, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant