Unified · Split
| @@ -29,9 +29,6 @@ export const TypeId: TypeId = "~local/sqlite-node/SqliteClient"; · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | export type TypeId = "~local/sqlite-node/SqliteClient"; | 30 | export type TypeId = "~local/sqlite-node/SqliteClient"; |
| 31 | 31 | ||
| 32 | const classifyError = (cause: unknown, message: string, operation: string) => | ||
| 33 | classifySqliteError(cause, { message, operation }); | ||
| 34 | |||
| 35 | /** | 32 | /** |
| 36 | * SqliteClient - Effect service tag for the sqlite SQL client. | 33 | * SqliteClient - Effect service tag for the sqlite SQL client. |
| 37 | */ | 34 | */ |
| @@ -114,7 +111,10 @@ const makeWithDatabase = ( · 76 unmodified lines | |||
| 114 | try: () => db.prepare(sql), | 111 | try: () => db.prepare(sql), |
| 115 | catch: (cause) => | 112 | catch: (cause) => |
| 116 | new SqlError({ | 113 | 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 | }), | ||
| 118 | }), | 118 | }), |
| 119 | }), | 119 | }), |
| 120 | }); | 120 | }); |
| @@ -135,7 +135,10 @@ const makeWithDatabase = ( · 14 unmodified lines | |||
| 135 | } catch (cause) { | 135 | } catch (cause) { |
| 136 | return Effect.fail( | 136 | return Effect.fail( |
| 137 | new SqlError({ | 137 | 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 | }), | ||
| 139 | }), | 142 | }), |
| 140 | ); | 143 | ); |
| 141 | } | 144 | } |
| @@ -162,7 +165,10 @@ const makeWithDatabase = ( · 20 unmodified lines | |||
| 162 | }, | 165 | }, |
| 163 | catch: (cause) => | 166 | catch: (cause) => |
| 164 | new SqlError({ | 167 | 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 | }), | ||
| 166 | }), | 172 | }), |
| 167 | }), | 173 | }), |
| 168 | (statement) => | 174 | (statement) => |