1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-07 02:28:54 +08:00

fix error handling for web worker in Firefox #27

This commit is contained in:
lana-k
2021-04-24 16:53:19 +02:00
parent a7ef152140
commit 24411ac18f
2 changed files with 4 additions and 4 deletions

View File

@@ -59,7 +59,7 @@ class Database {
}) })
if (result.error) { if (result.error) {
throw result.error throw new Error(result.error)
} }
return await this.getSchema(name) return await this.getSchema(name)
@@ -70,7 +70,7 @@ class Database {
const res = await this.pw.postMessage({ action: 'open', buffer: fileContent }) const res = await this.pw.postMessage({ action: 'open', buffer: fileContent })
if (res.error) { if (res.error) {
throw res.error throw new Error(res.error)
} }
return this.getSchema(file.name) return this.getSchema(file.name)
@@ -103,7 +103,7 @@ class Database {
const results = await this.pw.postMessage({ action: 'exec', sql: commands }) const results = await this.pw.postMessage({ action: 'exec', sql: commands })
if (results.error) { if (results.error) {
throw results.error throw new Error(results.error)
} }
// if it was more than one select - take only the last one // if it was more than one select - take only the last one
return results[results.length - 1] return results[results.length - 1]

View File

@@ -23,7 +23,7 @@ function processMsg (sql) {
function onError (error) { function onError (error) {
return { return {
error error: error.message
} }
} }