aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-prologue.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-10-02 00:09:40 +0000
committerstephan <stephan@noemail.net>2022-10-02 00:09:40 +0000
commit193ee11fe1f7ce00ecb9c65dd95e4d0f779400e5 (patch)
tree89404944cc622672d1bd1b1ff8a21603cb55dc7b /ext/wasm/api/sqlite3-api-prologue.js
parentf064a3bbe450ba2d18a6daec6293302902887f8e (diff)
downloadsqlite-193ee11fe1f7ce00ecb9c65dd95e4d0f779400e5.tar.gz
sqlite-193ee11fe1f7ce00ecb9c65dd95e4d0f779400e5.zip
General internal cleanups in the oo1 API.
FossilOrigin-Name: f9db664f756f3707afcb5dce87f6d946625848f27ea84337af68de72d4ad6c6b
Diffstat (limited to 'ext/wasm/api/sqlite3-api-prologue.js')
-rw-r--r--ext/wasm/api/sqlite3-api-prologue.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js
index b00eeb863..97376be6c 100644
--- a/ext/wasm/api/sqlite3-api-prologue.js
+++ b/ext/wasm/api/sqlite3-api-prologue.js
@@ -785,7 +785,9 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
be released using restore().
This method always adjusts the given value to be a multiple
- of 8 in order to keep alignment guarantees.
+ of 8 bytes because failing to do so can lead to incorrect
+ results when reading and writing 64-bit values from/to the WASM
+ heap.
*/
alloc: capi.wasm.exports.sqlite3_wasm_pstack_alloc
});
@@ -809,6 +811,24 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
get: capi.wasm.exports.sqlite3_wasm_pstack_remaining
});
+ /**
+ An Error subclass specifically for reporting DB-level errors and
+ enabling clients to unambiguously identify such exceptions.
+ The C-level APIs never throw, but some of the higher-level
+ C-style APIs do and the object-oriented APIs use exceptions
+ exclusively to report errors.
+ */
+ class SQLite3Error extends Error {
+ /**
+ Constructs this object with a message equal to all arguments
+ concatenated with a space between each one.
+ */
+ constructor(...args){
+ super(args.join(' '));
+ this.name = 'SQLite3Error';
+ }
+ };
+
/** State for sqlite3_wasmfs_opfs_dir(). */
let __persistentDir = undefined;
@@ -1059,6 +1079,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
/* The remainder of the API will be set up in later steps. */
const sqlite3 = {
WasmAllocError: WasmAllocError,
+ SQLite3Error: SQLite3Error,
capi,
config,
/**