mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-07 10:38:54 +08:00
fix error handling for web worker in Firefox #27
This commit is contained in:
@@ -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]
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function processMsg (sql) {
|
|||||||
|
|
||||||
function onError (error) {
|
function onError (error) {
|
||||||
return {
|
return {
|
||||||
error
|
error: error.message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user