Skip to content

Return a specific error code in the API error for compliance check failure - #3938

Merged
rhysyngsun merged 2 commits into
mainfrom
nl/export-compliance-error-code
Oct 6, 2026
Merged

rhysyngsun merged 2 commits into
mainfrom
nl/export-compliance-error-code

Conversation

@rhysyngsun

@rhysyngsun rhysyngsun commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

https://github.com/mitodl/hq/issues/13250

Description (What does it do?)

An enrollment blocked by a CyberSource export compliance rejection returned the same opaque detail as every other enrollment failure, so a learner contacting support had nothing to quote — and no way to know that retrying could not work.

  • ExportComplianceError now declares error_code = "CS_700".
  • EnrollmentError.from_cause(exc) appends it, giving "Unable to complete enrollment. Error code: CS_700".

How can this be tested?

Tests should pass, this can be functionally testing with the work in mitodl/mit-learn#3918

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

OpenAPI Changes

Show/hide changes
## Changes for v0.yaml:
No changes detected

## Changes for v1.yaml:
No changes detected

## Changes for v2.yaml:
No changes detected

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@rhysyngsun rhysyngsun changed the title Tag export compliance rejections with a support code Display backend error message on enrollment failure Sep 9, 2026
@rhysyngsun rhysyngsun changed the title Display backend error message on enrollment failure Return a specific error code in the API error for compliance check failure Sep 9, 2026
@rhysyngsun
rhysyngsun marked this pull request as ready for review September 14, 2026 18:19
Comment thread courses/views/v1/views_test.py Outdated
@rhysyngsun
rhysyngsun force-pushed the nl/export-compliance-error-code branch from ab10f71 to 4066118 Compare September 14, 2026 19:02
@cp-at-mit cp-at-mit self-assigned this Sep 15, 2026
@rhysyngsun
rhysyngsun force-pushed the nl/export-compliance-error-code branch 3 times, most recently from 4bf833a to a6c9d8e Compare September 22, 2026 20:20
@rhysyngsun
rhysyngsun added this pull request to stack #4021 September 24, 2026 13:40
@rhysyngsun
rhysyngsun force-pushed the nl/export-compliance-error-code branch from a6c9d8e to 7d30455 Compare September 24, 2026 15:22
@rhysyngsun
rhysyngsun force-pushed the nl/export-compliance-error-code branch 4 times, most recently from 8a6b41c to a2e63ef Compare October 5, 2026 14:30
rhysyngsun and others added 2 commits October 6, 2026 15:02
An enrollment blocked by a CyberSource export compliance rejection
returned the same opaque 400 detail as every other enrollment failure,
so a learner contacting support had nothing to quote and no way to know
retrying could not help.

ExportComplianceError now declares error_code = "CS_700", and
EnrollmentError.from_cause appends it to the detail. Causes that declare
no code — including ExportComplianceDataError, which never reached
CyberSource and so has no CyberSource code — keep the detail unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@rhysyngsun
rhysyngsun force-pushed the nl/export-compliance-error-code branch from a2e63ef to f228f84 Compare October 6, 2026 19:02
@rhysyngsun
rhysyngsun merged commit b8c9b5f into main Oct 6, 2026
15 checks passed
@rhysyngsun
rhysyngsun deleted the nl/export-compliance-error-code branch October 6, 2026 19:44
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.

3 participants