Thrown when a value (or a key) can't be stored the same way by both engines.
Covers the payloads JSON.stringify is happy to mangle — undefined, NaN, Infinity — plus
NUL (\u0000), which SQLite keeps as TEXT and Postgres JSONB rejects outright. Also the older
two: circular references & BigInt.
Remarks
Extends TypeError on purpose => set() has always thrown a TypeError for a value it can't
serialize, so anything catching that keeps working, and new code gets err.code &
instanceof InvalidValueError to branch on.
Example
try { awaitdb.schema('economy').table('balances').key(userId).set({ coins:total }); } catch (err) { // total came out NaN => the write was refused instead of storing null if (errinstanceofInvalidValueError) logger.warn(err.message); }
Thrown when a value (or a key) can't be stored the same way by both engines.
Covers the payloads
JSON.stringifyis happy to mangle —undefined,NaN,Infinity— plus NUL (\u0000), which SQLite keeps as TEXT and Postgres JSONB rejects outright. Also the older two: circular references & BigInt.Remarks
Extends
TypeErroron purpose =>set()has always thrown aTypeErrorfor a value it can't serialize, so anything catching that keeps working, and new code getserr.code&instanceof InvalidValueErrorto branch on.Example