LG-6139: Handle and display password confirm errors#6337
Merged
Conversation
**Why**: The point of the `type` property is that if/when we log details around the error, the types are uniquely identifying the sort of error that occurred. They should be unique from one another, and locale-independent.
So we can show them in the UI
**Why**: So that the user only proceeds to the next step with a valid submission, and so that they know what they need to do to correct the issue. changelog: Upcoming Features, Identity Verification, Add password confirmation step
This existed previously because the base FormError customized arguments of the constructor to receive only an options object, not a message. Since the base constructor now receives message as the first argument, the override can be removed.
zachmargolis
approved these changes
May 12, 2022
| @@ -1,3 +1,7 @@ | |||
| export interface ErrorResponse<Field extends string> { | |||
| error: Record<Field, [string, ...string[]]>; | |||
Contributor
There was a problem hiding this comment.
is this this [string, ...string[]] type a way to say "string[] with length at least 1"?
Contributor
Author
There was a problem hiding this comment.
is this this
[string, ...string[]]type a way to say "string[]with length at least 1"?
Yes, exactly that. I don't know that it's strictly necessary here, but it seems reasonable to expect that if the response is an error response, there's at least one error message.
solipet
reviewed
May 12, 2022
Contributor
solipet
left a comment
There was a problem hiding this comment.
LGTM. I updated the description with the correct key (idv_api_enabled_steps vs idv_api_steps_enabled and it worked as described.
| rescue ::Api::UserBundleError => err | ||
| errors.add(:jwt, "malformed user bundle: #{err.message}", type: :invalid) | ||
| rescue JWT::DecodeError | ||
| errors.add(:jwt, I18n.t('idv.failure.exceptions.internal_error'), type: :decode_error) |
solipet
approved these changes
May 12, 2022
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why: So that the user only proceeds to the next step with a valid submission, and so that they know what they need to do to correct the issue.
Testing Instructions:
idv_api_enabled_steps: '["password_confirm","personal_key","personal_key_confirm"]'in localconfig/application.ymlScreenshot:
In the screenshot below, note that "Before" shows that the application would previously crash, due to assumptions that the API request would have been successful.