Gracefully handle the case where inputs to multiSet are not of the type Array<Array<String>>
See original GitHub issueMotivation
At present, React Native applications will crash when AsyncStorage.multiSet
is called with invalid arguments, for example, AsyncStorage.multiSet(['a', 'b'], ['c', 'd'])
. Note that in this case, there are 2 arguments provided to the function for the keyValuePairs
required to store as data. However, this happens to be a typo and the developer actually intended to wrap it with square brackets, but failed to do so.
Since there is no error thrown, the application literally just crashes and makes debugging almost impossible.
Description
An exception should be raised when the type of the inputs to the keyValuePairs argument of multiSet is incorrect, instead of simply letting the application crash.
New feature implementation
Type comparison of the first argument would be crucial in correcting this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
@kiranjd Another possibility would be to handle the case where
multiSet
is called with n arguments@kiranjd: Please go ahead and submit a PR 😃