如何从Expo SQLite API中获取sql错误的原因?

Edu*_*zer 8 react-native expo create-react-native-app

拥有以下代码:

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})
  })
})
Run Code Online (Sandbox Code Playgroud)

如何获取sqlite错误消息,以确定导致此错误的原因(在本例中为无效表)?

API文档说我的误差函数" 有两个参数:交易本身,以及错误对象 ",但我找不到在没有这些错误描述.

我做了一个小吃模拟这个场景.

And*_*s B 7

这为我记录了错误

  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);
    })
  })
Run Code Online (Sandbox Code Playgroud)