Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions apps/server/src/persistence/NodeSqliteClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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",
}),
}),
}),
});
Expand All @@ -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",
}),
}),
);
}
Expand All @@ -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) =>
Expand Down
Loading