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

Do not understand how this warning is occuring: warning - exception while invoking a callback: {"code":0} #490

Closed ProfessionalAmateur closed 2 years ago

ProfessionalAmateur commented 2 years ago

I have created a sample test app to test out sqlite3 with React-Native. As part of my testing I'm intentionally inserting a duplicate record into a table to catch and deal with the error. The app is correctly going into the error callback but Im also getting a mystery warning that I cannot determine the cause from: warning - exception while invoking a callback: {"code":0}

My insert statement looks like this:


 db.executeSql("INSERT INTO TestTable (primaryKey) VALUES (?);",  
 ["Key1"],  
 (results: any) => {console.log("Cb Success"); resolve(results)},  
 (err: any) => {console.log("Cb Error"); reject(err)});

My logs look like this:


C:\React\SqliteSandbox\DB.tsx:119 Cb Error //<-- Completely expected from error callback
C:\React\SqliteSandbox\node_modules\react-native-sqlite-storage\lib\sqlite.core.js:94 warning - exception while invoking a callback: {"code":0} //<-- I have no idea where this comes from?
C:\React\SqliteSandbox\ScreenOne.tsx:31 ScreenOne Insert Error: [object Object]  //<-- this is from the calling button that catches the promise rejection

Context

Trying to evaluate Sqlite for React-Native project to replace Realm DB

Your Environment

andpor commented 2 years ago

Suggest you use debugger in your IDE to dig more into this issue.