itinance / itinance/react-native-fs
writeFile etc, to resolve something not nil only
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
I frequently use writeFile a few times in a function, so I used ```await```:
```JS
let task;
task = await RNFS.writeFile(file, JSON.stringify(data), 'utf8').catch((err) => alert('something wrong?'));
if (task === undefined) {
// the task is failed
}
task = await RNFS.writeFile(file2, JSON.stringify(data2), 'utf8').catch((err) => alert('something wrong?'));
if (task === undefined) {
// the task is failed
}
```
So far ```writeFile``` will resolve nothing when its success, then its not able to catch the failure of this await express. Maybe writeFile should resolve something like "success", so its easier to distinguish the success from error.
Thanks.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.