Skip to content

fix(api): stop returning exception text from metadata export - #245

Merged
anantjain341 merged 1 commit into
CivicDataLab:devfrom
anantjain341:fix/export-error-exposure
Oct 12, 2026
Merged

anantjain341 merged 1 commit into
CivicDataLab:devfrom
anantjain341:fix/export-error-exposure

Conversation

@anantjain341

Copy link
Copy Markdown
Contributor

Fixes #240. Implements the fix @saqibmanan proposed in the issue.

  • api/views/metadata_export.py now checks standard and format against export_options() before exporting, and returns a fixed 400 message with the options.
  • The except ValueError that returned str(exc) is removed; every other error falls to the existing logged generic 500.

The export view caught every ValueError around export_dataset() and sent
str(exc) back with a 400, so internal errors (crosswalk, dates, rdflib)
reached anonymous users verbatim and were reported as client errors.

Validate standard and format against export_options() before exporting
and answer with a fixed message plus the options. Every other failure
now falls to the logged generic 500.

Closes CivicDataLab#240
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