Skip to content

LG-10973: Log heading and error message when warning shown#9255

Merged
night-jellyfish merged 6 commits intomainfrom
brittany/lg-10973-log-error-message-with-warning-shown
Oct 2, 2023
Merged

LG-10973: Log heading and error message when warning shown#9255
night-jellyfish merged 6 commits intomainfrom
brittany/lg-10973-log-error-message-with-warning-shown

Conversation

@night-jellyfish
Copy link
Contributor

@night-jellyfish night-jellyfish commented Sep 22, 2023

🎫 Ticket

Ticket: https://cm-jira.usa.gov/browse/LG-10973

🛠 Summary of changes

Currently, the Frontend: IdV: warning shown event does not tell us what error the user saw, only that an error message was displayed. There were a couple of times where a user's uploaded photo has a few errors, and we weren't sure which message they actually saw. For example, a case where this might appear is when the user uploaded a passport image with an unreadable address, we wanted to be sure that they saw the "wrong doc type" messaging and not the "couldn't read address" messaging.

This change logs the heading and error shown so that in the future we can check what the user saw with relative ease.

📜 Testing Plan

  • Follow the flow through to the photo upload page
  • Upload photos that will cause an error (maybe one PII error and one doc type error)
  • Hit submit and stay on the warning page
  • Search the log/events.log for the Frontend: IdV: warning shown entry
  • Look for the heading property and check that it matches what you see on the page
  • Look for the errorMessageDisplayed property and check that it matches what you see on the page

👀 Screenshots

Not exactly a screenshot, but here is the change in logs for a DOB entry error (log shortened with [...]):

Before:
{"name":"Frontend: IdV: warning shown",
"properties":{
    "event_properties":{
        "location":"doc_auth_review_issues",
        "remaining_attempts":76,
        "flow_path":"standard",
    [...]
"log_filename":"events.log"}
After:
{"name":"Frontend: IdV: warning shown",
"properties":
    {"event_properties":{
            "location":"doc_auth_review_issues",
            "remaining_attempts":79,
            "heading":"We couldn’t verify your ID",
            "errorMessageDisplayed":"We couldn’t read the birth date on your ID. Try taking new pictures.",
            "flow_path":"standard",
    [...]
"log_filename":"events.log"}

@night-jellyfish night-jellyfish force-pushed the brittany/lg-10973-log-error-message-with-warning-shown branch from 58f9fb7 to 449618a Compare September 25, 2023 19:27
@night-jellyfish night-jellyfish requested review from a team and dawei-nava and removed request for a team September 27, 2023 16:50
Copy link
Contributor

@dawei-nava dawei-nava Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, another possible way is to wrap UknownError with forwardRef(looks like it returns paragraph element for all scenarios). and create the ref and avoid creating additional div

const errorMessageDisplayedRef = useRef<HTMLParagraphElement>(null)

Copy link
Contributor

@dawei-nava dawei-nava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for now, may be we can refactor the error part once Kelli audit all the alerts/errors.

Brittany Greaner added 6 commits October 2, 2023 11:12
Technical notes:

- currently there will probably only be one general or one pii error
message. But in the off chance that that changes in the future, we
wanted to account for that with the `join`.
@night-jellyfish night-jellyfish force-pushed the brittany/lg-10973-log-error-message-with-warning-shown branch from aa67250 to dc6379e Compare October 2, 2023 18:12
@night-jellyfish night-jellyfish merged commit 36077ad into main Oct 2, 2023
@night-jellyfish night-jellyfish deleted the brittany/lg-10973-log-error-message-with-warning-shown branch October 2, 2023 20:31
@jmhooper jmhooper mentioned this pull request Oct 3, 2023
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