Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Handling the reject of getRandomBytes for both iOS and Android. #524

Merged
merged 1 commit into from
Jul 8, 2020

Conversation

jeberhardt
Copy link
Contributor

In both of the cases where getRandomBytes is called, if an error occurs, it will be logged so we know it happened, and thrown again and caught by the error handlers of FormView and ConsentView.

@jeberhardt jeberhardt requested a review from a team as a code owner July 8, 2020 11:47
Copy link

@obrien-j obrien-j left a comment

Choose a reason for hiding this comment

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

Looks good from my end.

Minor nit on the
} Catch (error) pattern, vs catch (exception), but that may be a common pattern in JS/React land, so not the end of the world.

As long as console.error tosses the stack trace, (assuming we want it), no objections.

I'll leave final approval to the team.

@jeberhardt
Copy link
Contributor Author

jeberhardt commented Jul 8, 2020

@obrien-j - In the rest of the *ts code, catch(error) is everywhere. I used exception in the Kotlin file though. ;)

@jeberhardt jeberhardt merged commit 7d15b01 into master Jul 8, 2020
val bytes = SecureRandom().generateSeed(size)
val base64Encoded = Base64.encodeToString(bytes, Base64.DEFAULT)
promise.resolve(base64Encoded)
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to try / catch here because .launch extension already handle exception.

Maybe next time, please ping me to PR for review whenever we change native code as I would like to bring it over to original repo too. 🙇

cc @jeberhardt @timarney

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MOB-M-7: iOS reject not called in failure case CovidShield::getRandomBytes
4 participants