diff options
author | stephan <stephan@noemail.net> | 2022-11-29 06:09:32 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-11-29 06:09:32 +0000 |
commit | ceedef888f38d172c203b1c7bf5265f4ee608640 (patch) | |
tree | 7d0c6da0ff60082a1269453fc361c45e52652314 /ext/wasm/api/sqlite3-opfs-async-proxy.js | |
parent | 04184761de820ac763036157ff07b2f22a89db77 (diff) | |
download | sqlite-ceedef888f38d172c203b1c7bf5265f4ee608640.tar.gz sqlite-ceedef888f38d172c203b1c7bf5265f4ee608640.zip |
Minor internal cleanups and docs in the OPFS sqlite3_vfs.
FossilOrigin-Name: 61799b05ff232c2ac349169c27bfe7f8d9277366093b0c9dd2739828993b3066
Diffstat (limited to 'ext/wasm/api/sqlite3-opfs-async-proxy.js')
-rw-r--r-- | ext/wasm/api/sqlite3-opfs-async-proxy.js | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/ext/wasm/api/sqlite3-opfs-async-proxy.js b/ext/wasm/api/sqlite3-opfs-async-proxy.js index 1ba6e9bdb..a80eeb290 100644 --- a/ext/wasm/api/sqlite3-opfs-async-proxy.js +++ b/ext/wasm/api/sqlite3-opfs-async-proxy.js @@ -239,15 +239,26 @@ const installAsyncProxy = function(self){ between locking-related failures and other types, noting that we cannot currently do so because createSyncAccessHandle() does not define its exceptions in the required level of detail. + + 2022-11-29: according to: + + https://github.com/whatwg/fs/pull/21 + + NoModificationAllowedError will be the standard exception thrown + when acquisition of a sync access handle fails due to a locking + error. As of this writing, that error type is not visible in the + dev console in Chrome v109, nor is it documented in MDN, but an + error with that "name" property is being thrown from the OPFS + layer. */ class GetSyncHandleError extends Error { constructor(errorObject, ...msg){ - super(); - this.error = errorObject; - this.message = [ - ...msg, ': Original exception ['+errorObject.name+']:', + super([ + ...msg, ': '+errorObject.name+':', errorObject.message - ].join(' '); + ].join(' '), { + cause: errorObject + }); this.name = 'GetSyncHandleError'; } }; @@ -259,8 +270,12 @@ const installAsyncProxy = function(self){ distinguish that from other errors. This approach is highly questionable. + + Note that even if we return SQLITE_IOERR_LOCK from here, + it bubbles up to the client as a plain I/O error. */ - return (e instanceof GetSyncHandleError) + return (e instanceof GetSyncHandleError + && e.cause.name==='NoModificationAllowedError') ? state.sq3Codes.SQLITE_IOERR_LOCK : rc; }else{ |