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

refactor: check for .message in verification error #1443

Merged
merged 1 commit into from
Mar 24, 2021

Conversation

mantariksh
Copy link
Contributor

Problem

Across nearly all APIs in this repo, the server returns a JSON with a message key when an error occurs. However, the Verification module is an exception, as it returns one of a set of custom strings (e.g. 'SEND_OTP_FAILED', 'INVALID_OTP'), and the frontend contains a switch statement to determine what error message to display.

We want APIs to behave consistently, so it would be good for the Verification module to return error objects in the form { message: 'some error message' }. However, this would be a backwards-incompatible change as the current frontend would render the entire JSON object instead of just the message string.

Solution

This PR ensures that the API change will be backwards-compatible by checking for a message property on the error. #1440 will address the actual API change.

Copy link
Contributor

@tshuli tshuli left a comment

Choose a reason for hiding this comment

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

lgtm!

@mantariksh mantariksh merged commit 8cbca13 into develop Mar 24, 2021
@liangyuanruo liangyuanruo deleted the ref/vfn-error-message branch March 29, 2021 02:55
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