Skip to content

fix(usfm): stop leaking raw error detail in sync export 500s#200

Merged
henrique221 merged 1 commit into
mainfrom
fix/195-usfm-export-error-handling
Jun 23, 2026
Merged

fix(usfm): stop leaking raw error detail in sync export 500s#200
henrique221 merged 1 commit into
mainfrom
fix/195-usfm-export-error-handling

Conversation

@henrique221

@henrique221 henrique221 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Part of #195.

Summary

The sync USFM export handlers (exportProjectUSFMRoute and the exportable-books
handler) returned the raw exception message to the client via details. The
full error is already logged server-side (logger.error → App Insights with
projectUnitId/bookIds), so this drops details from the client 500
responses and removes the now-unused ErrorResponse interface.

Scope

Companion

The user-facing half of #195 is in fluent-web: send credentials on the
export request + surface the server message in the export dialog (separate PR).

Test plan

  • npm run typecheck
  • npm run lint
  • npm run test — 80/80 pass

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced error handling for export operations with simplified error responses. Error messages now provide generic information only, without exposing internal system details to users.
  • Refactor

    • Removed unused error response helper type to streamline the codebase.

The sync export and exportable-books handlers returned the raw exception
message to the client via `details`. The full error is already logged
server-side (logger.error → App Insights with projectUnitId/bookIds), so
drop `details` from the client response and remove the now-unused
ErrorResponse interface. Async-path handlers are left for the async
pipeline hardening (#196).

Refs #195
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b97dc21e-1964-4586-8ef9-bb2729943704

📥 Commits

Reviewing files that changed from the base of the PR and between 1d9517b and 7789c12.

📒 Files selected for processing (1)
  • src/domains/usfm/usfm.route.ts

📝 Walkthrough

Walkthrough

Two catch blocks in usfm.route.ts are updated to remove the details field from 500 error responses. The "get exportable books" and synchronous USFM export routes now return only a generic error string, and the ErrorResponse helper type is removed.

Changes

USFM Route Error Response Hardening

Layer / File(s) Summary
Strip raw error details from USFM route catch blocks
src/domains/usfm/usfm.route.ts
Both catch blocks now return { error: '...' } with status 500, omitting the details field that previously forwarded raw internal error messages. The ErrorResponse helper type is removed alongside this change.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main change: removing raw error details from sync USFM export 500 responses, which is the primary objective of the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/195-usfm-export-error-handling

Comment @coderabbitai help to get the list of available commands and usage tips.

@henrique221
henrique221 merged commit bff9972 into main Jun 23, 2026
2 checks passed
@github-actions
github-actions Bot deleted the fix/195-usfm-export-error-handling branch June 23, 2026 17:32
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.

2 participants