Skip to content

Commit 1ae20fa

Browse files
committed
fix(persistence): revert classifySqliteError to SqlError({ cause, message })
classifySqliteError does not exist in effect@4.0.0-beta.42. Revert the NodeSqliteClient error constructors to the signature available in the installed version.
1 parent 23b3f0c commit 1ae20fa

1 file changed

Lines changed: 4 additions & 17 deletions

File tree

apps/server/src/persistence/NodeSqliteClient.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import * as Stream from "effect/Stream";
2020
import * as Reactivity from "effect/unstable/reactivity/Reactivity";
2121
import * as Client from "effect/unstable/sql/SqlClient";
2222
import type { Connection } from "effect/unstable/sql/SqlConnection";
23-
import { SqlError, classifySqliteError } from "effect/unstable/sql/SqlError";
23+
import { SqlError } from "effect/unstable/sql/SqlError";
2424
import * as Statement from "effect/unstable/sql/Statement";
2525

2626
const ATTR_DB_SYSTEM_NAME = "db.system.name";
@@ -29,9 +29,6 @@ export const TypeId: TypeId = "~local/sqlite-node/SqliteClient";
2929

3030
export type TypeId = "~local/sqlite-node/SqliteClient";
3131

32-
const 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
*/
@@ -112,10 +109,7 @@ const makeWithDatabase = (
112109
lookup: (sql: string) =>
113110
Effect.try({
114111
try: () => db.prepare(sql),
115-
catch: (cause) =>
116-
new SqlError({
117-
reason: classifyError(cause, "Failed to prepare statement", "prepare"),
118-
}),
112+
catch: (cause) => new SqlError({ cause, message: "Failed to prepare statement" }),
119113
}),
120114
});
121115

@@ -133,11 +127,7 @@ const makeWithDatabase = (
133127
const result = statement.run(...(params as any));
134128
return Effect.succeed(raw ? (result as unknown as ReadonlyArray<any>) : []);
135129
} catch (cause) {
136-
return Effect.fail(
137-
new SqlError({
138-
reason: classifyError(cause, "Failed to execute statement", "execute"),
139-
}),
140-
);
130+
return Effect.fail(new SqlError({ cause, message: "Failed to execute statement" }));
141131
}
142132
});
143133

@@ -160,10 +150,7 @@ const makeWithDatabase = (
160150
statement.run(...(params as any));
161151
return [];
162152
},
163-
catch: (cause) =>
164-
new SqlError({
165-
reason: classifyError(cause, "Failed to execute statement", "execute"),
166-
}),
153+
catch: (cause) => new SqlError({ cause, message: "Failed to execute statement" }),
167154
}),
168155
(statement) =>
169156
Effect.sync(() => {

0 commit comments

Comments
 (0)