andpor / react-native-sqlite-storage

Full featured SQLite3 Native Plugin for React Native (Android and iOS)
MIT License
2.75k stars 521 forks source link

Bugfix: define plugin.error and reject any unknow type parameter in addStatement #450

Open halaei opened 3 years ago

halaei commented 3 years ago

Currently passing an object or function as parameter causes an unhandled exception, without calling error callbacks or rejecting promise. The reason is that, on such inputs, an undefined function plugin.error()/plugin.warn() is called. Reading the code, it was expected to accept anything other than functions, but this PR reject objects as well, because it is more consistent with the current behaviour, and I think such inputs should be regarded as invalid anyway.

PS: my editor automatically removes extra spaces from some irrelevant lines. Sorry about that.

halaei commented 3 years ago

See https://github.com/andpor/react-native-sqlite-storage/issues/402