From bc1024caf09aa349f18dd72aaf823588f3ff1fec Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 28 Mar 2026 22:55:18 -0700 Subject: [PATCH] Inline sqlite error classification (#1515) --- .../server/src/persistence/NodeSqliteClient.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/server/src/persistence/NodeSqliteClient.ts b/apps/server/src/persistence/NodeSqliteClient.ts index 5577ac5b0174dbe5edcd2482f5f20e636ffab07c..78dbe8a1a90de2a4d6e7345b61c7997a6037dcb3 100644 --- a/apps/server/src/persistence/NodeSqliteClient.ts +++ b/apps/server/src/persistence/NodeSqliteClient.ts @@ -29,9 +29,6 @@ export const TypeId: TypeId = "~local/sqlite-node/SqliteClient"; export type TypeId = "~local/sqlite-node/SqliteClient"; -const classifyError = (cause: unknown, message: string, operation: string) => - classifySqliteError(cause, { message, operation }); - /** * SqliteClient - Effect service tag for the sqlite SQL client. */ @@ -114,7 +111,10 @@ const makeWithDatabase = ( try: () => db.prepare(sql), catch: (cause) => new SqlError({ - reason: classifyError(cause, "Failed to prepare statement", "prepare"), + reason: classifySqliteError(cause, { + message: "Failed to prepare statement", + operation: "prepare", + }), }), }), }); @@ -135,7 +135,10 @@ const makeWithDatabase = ( } catch (cause) { return Effect.fail( new SqlError({ - reason: classifyError(cause, "Failed to execute statement", "execute"), + reason: classifySqliteError(cause, { + message: "Failed to execute statement", + operation: "execute", + }), }), ); } @@ -162,7 +165,10 @@ const makeWithDatabase = ( }, catch: (cause) => new SqlError({ - reason: classifyError(cause, "Failed to execute statement", "execute"), + reason: classifySqliteError(cause, { + message: "Failed to execute statement", + operation: "execute", + }), }), }), (statement) => -- 2.54.0