Skip to content
Commit Detail

Commit d8f57c0

Author
Samuel Merritt <smerritt@cloudflare.com> 2024-07-11 10:12:28 -0700
Parents
36aa49e
Tree
b811d4c
Better SQLite error message generation.

The error messages now have the error code in them, either something
like SQLITE_TOOBIG or SQLITE_FORMAT if it's a known code, or
SQLITE_UNKNOWN_ERROR_CODE(%d) if it's not known to us.

SQLite doesn't provide any function to do this for us. It has an
internal function sqlite3ErrName that looks a lot like the giant
switch statement in this commit, but (a) it's not exposed to library
consumers, and (b) it's only present if compiled with certain flags
like SQLITE_DEBUG that also turn on a bunch of other stuff.

I considered patching SQLite to expose sqlite3ErrName, but I think
it's easier for workerd maintainers to deal with adding the occasional
new case to a switch statement we own than itis to maintain yet
another SQLite patch.

Files changed

2 files changed~2 modified