cal-itp / benefits

Transit benefits enrollment, minus the paperwork.
https://docs.calitp.org/benefits
GNU Affero General Public License v3.0
25 stars 9 forks source link

Feat: system enrollment error - 500 error when linking #2088

Closed angela-tran closed 2 months ago

angela-tran commented 2 months ago

Part of #2032

This PR implements the system enrollment error page template and adds error-handling to the benefits.enrollment.views.index function so that if a 500-level HTTP error occurs when we try to link a funding source to a group, the system enrollment error page will be shown. The CTA takes the user back to the agency index.

A Sentry notification will be sent - see an example from my testing. Note: since I don't know how to cause an actual 500 error with the linking endpoint, I had to add some code locally to fake it (more details in steps for reviewing / testing).

Screenshots

Expand | Desktop | Mobile | | --- | --- | | ![image](https://github.com/cal-itp/benefits/assets/25497886/44ef562f-6a66-4bd8-84ca-ee180c3c5e7d) | ![image](https://github.com/cal-itp/benefits/assets/25497886/932e0e10-bfdc-4e27-87c9-76b813f93b67) | | ![image](https://github.com/cal-itp/benefits/assets/25497886/00a7734f-8720-497e-8ad5-f7214742c442) | ![image](https://github.com/cal-itp/benefits/assets/25497886/d51783ff-bb5d-4eb9-a8ea-eb4835f81538) |

Steps for reviewing / testing

To simulate a 500-level HTTP error, I added this to my index function:

       try:
+           class response:
+               def __init__(self):
+                   self.status_code = 500
+           raise HTTPError(response=response())
            client.link_concession_group_funding_source(funding_source_id=funding_source.id, group_id=eligibility.group_id)
        except HTTPError as e:

Then run through a Login.gov flow and non-Login.gov flow all the way through enrollment as normal to see the system enrollment error page.

github-actions[bot] commented 2 months ago

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits/enrollment
  views.py
Project Total  

This report was generated by python-coverage-comment-action

angela-tran commented 2 months ago

I forgot to run ./bin/makemessages.sh! Commit incoming

thekaveman commented 2 months ago

I rebased on dev to clean up conflicts in the PO files

thekaveman commented 2 months ago

Rebased on dev one more time to resolve conflicts with #2067, and added the Spanish translations for this page.

I also updated the page title in English and Spanish using the latest from the copy spreadsheet.