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: remove try-catch from submissions pipeline #1315

Merged
merged 4 commits into from
Mar 8, 2021

Conversation

mantariksh
Copy link
Contributor

@mantariksh mantariksh commented Mar 8, 2021

Problem

We previously inserted two try-catch blocks in the submissions pipeline as the answer field on some responses was undefined due to an unknown bug. We later found that the bug was due to missing SingPass/CorpPass cookies, and the bug was fixed in #918.

As shown in the following queries in CloudWatch, we have had no instances of these errors in the past 4 weeks:
Screenshot 2021-03-08 at 7 28 38 PM
Screenshot 2021-03-08 at 7 40 51 PM

Closes #847

Solution

First, the try-catch blocks were removed. Then I noticed that the function createEmailData was just a dumb wrapper around SubmissionEmailObj, so I replaced all instances of the createEmailData function with a call to new SubmissionEmailObj. Since createEmailData had extensive unit tests, I simply changed all its unit tests to call new SubmissionEmailObj instead (see diagram below), and found that the tests still passed as expected.

Screenshot 2021-03-08 at 7 50 27 PM

Tests

  • Submit SingPass form in admin preview mode
  • Submit CorpPass form in admin preview mode
  • Submit MyInfo form in admin preview mode

Copy link
Contributor

@liangyuanruo liangyuanruo left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

I replaced all instances of the createEmailData function with a call to new SubmissionEmailObj

They would have to be updated eventually since the construction of parsedResponses is being moved into SubmissionEmailObj as the 2nd part of @tshuli 's refactor.

@liangyuanruo liangyuanruo merged commit b5643a5 into develop Mar 8, 2021
@liangyuanruo liangyuanruo deleted the ref/remove-trycatch branch March 8, 2021 13:27
@tshuli tshuli mentioned this pull request Mar 10, 2021
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.

Remove try-catch block due to undefined response answer
2 participants