Skip to content

Gracefully handle the case where inputs to multiSet are not of the type Array<Array<String>> #519

Closed
@bushshrub

Description

@bushshrub

Motivation

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions