authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-03-28 22:55:18-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-03-29 05:55:18+00:00
logbc1024caf09aa349f18dd72aaf823588f3ff1fec
treee7100dfc7d20c2599514b99a4d0804289e0a9af7
parenta1c428b6e266434e33b43d2e40d81d6851c1bb3c
signature Signed by PGP key B5690EEEBB952194

Inline sqlite error classification (#1515)


1 files changed, 12 insertions(+), 6 deletions(-)

apps/server/src/persistence/NodeSqliteClient.ts+12-6
......@@ -29,9 +29,6 @@ export const TypeId: TypeId = "~local/sqlite-node/SqliteClient";
2929
3030export type TypeId = "~local/sqlite-node/SqliteClient";
3131
32const classifyError = (cause: unknown, message: string, operation: string) =>
33 classifySqliteError(cause, { message, operation });
34
3532/**
3633 * SqliteClient - Effect service tag for the sqlite SQL client.
3734 */
......@@ -114,7 +111,10 @@ const makeWithDatabase = (
114111 try: () => db.prepare(sql),
115112 catch: (cause) =>
116113 new SqlError({
117 reason: classifyError(cause, "Failed to prepare statement", "prepare"),
114 reason: classifySqliteError(cause, {
115 message: "Failed to prepare statement",
116 operation: "prepare",
117 }),
118118 }),
119119 }),
120120 });
......@@ -135,7 +135,10 @@ const makeWithDatabase = (
135135 } catch (cause) {
136136 return Effect.fail(
137137 new SqlError({
138 reason: classifyError(cause, "Failed to execute statement", "execute"),
138 reason: classifySqliteError(cause, {
139 message: "Failed to execute statement",
140 operation: "execute",
141 }),
139142 }),
140143 );
141144 }
......@@ -162,7 +165,10 @@ const makeWithDatabase = (
162165 },
163166 catch: (cause) =>
164167 new SqlError({
165 reason: classifyError(cause, "Failed to execute statement", "execute"),
168 reason: classifySqliteError(cause, {
169 message: "Failed to execute statement",
170 operation: "execute",
171 }),
166172 }),
167173 }),
168174 (statement) =>