Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify default error message #1662

Merged
merged 2 commits into from
Jan 23, 2025
Merged

Conversation

gherceg
Copy link
Contributor

@gherceg gherceg commented Jan 17, 2025

Product Description

This results in the following difference:

image

vs
image

Technical Summary

The first example doesn't seem ideal to display to users. I believe getResponseBodyAsString should be sufficient to display the error to the user with enough information to take action or get help.

Safety Assurance

Safety story

This only impacts general errors on form submissions. I would assume that if a typical user comes across an error like this, they would be overwhelmed and potentially not even see the useful part of the message.

The risk is that we return errors with empty messages, in which case it will render like this:
image

Perhaps including the http status code at the very least would be helpful in the event the user receives an empty error message and reports it to us.

Automated test coverage

QA Plan

Special deploy instructions

  • This PR can be deployed after merge with no further considerations.

Rollback instructions

  • This PR can be reverted after deploy with no further considerations.

Review

  • The set of people pinged as reviewers is appropriate for the level of risk of the change.

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.32%. Comparing base (9400fc9) to head (abd953b).
Report is 11 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1662      +/-   ##
============================================
- Coverage     70.32%   70.32%   -0.01%     
  Complexity     2017     2017              
============================================
  Files           254      254              
  Lines          7920     7919       -1     
  Branches        746      746              
============================================
- Hits           5570     5569       -1     
  Misses         2070     2070              
  Partials        280      280              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gherceg gherceg marked this pull request as ready for review January 20, 2025 22:14
@gherceg gherceg requested a review from shubham1g5 January 20, 2025 22:14
@gherceg
Copy link
Contributor Author

gherceg commented Jan 20, 2025

I certainly don't have all of the context here, so @shubham1g5 if you or you know of anyone else who has thoughts on this, feel free to ping them. It seems ideal to make a change like this.

@@ -268,8 +268,7 @@ private SubmitResponseBean processFormXml(FormSubmissionContext context) throws
} catch (HttpClientErrorException e) {
return getErrorResponse(
context.getHttpRequest(), Constants.SUBMIT_RESPONSE_ERROR,
String.format("Form submission failed with error response: %s, %s, %s",
e.getMessage(), e.getResponseBodyAsString(), e.getResponseHeaders()),
String.format("Form submission failed with error response: %s", e.getResponseBodyAsString()),
Copy link
Contributor

Choose a reason for hiding this comment

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

agree that it will be helpful to have response code here when the reponse body is empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool updated to use getMessage which appears to include the status code in testing.

@gherceg gherceg merged commit 79e0ccf into master Jan 23, 2025
6 checks passed
@gherceg gherceg deleted the gh/exception-handling/general-message branch January 23, 2025 15:45
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