Having the following code:
import { SQLite } from 'expo';
const db = SQLite.openDatabase('mydb.db')
db.transaction( tx => {
tx.executeSql('insert into invalidTable values (?,?)', [1,2], null, (transact, err) => {
//I can't find error description in the objects below
console.log({transact, err})
})
})
How can I get the sqlite error message, to determine what exactly was the cause of this error (in this case, an invalid table)?
The API documentation says my error function "Takes two parameters: the transaction itself, and the error object", but I couldn't find the error description in none of these.
I did a snack simulating this scenario.
This logs the errors for me
import { SQLite } from 'expo';
const db = SQLite.openDatabase('mydb.db')
db.transaction(tx => {
tx.executeSql(sql, params, (_, { rows }) => {
console.log(rows._array)
}, (t, error) => {
console.log(error);
})
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With