@@ -3,8 +3,8 @@ import { Effect } from 'effect';
33import type * as V1 from '~/_relations.ts' ;
44import type { EffectCache } from '~/cache/core/cache-effect.ts' ;
55import type { WithCacheConfig } from '~/cache/core/types.ts' ;
6+ import { TaggedDrizzleQueryError , type TaggedTransactionRollbackError } from '~/effect-core/errors.ts' ;
67import { entityKind } from '~/entity.ts' ;
7- import { DrizzleQueryError , type TransactionRollbackError } from '~/errors.ts' ;
88import { type Logger , NoopLogger } from '~/logger.ts' ;
99import type { PgDialect } from '~/pg-core/dialect.ts' ;
1010import { PgEffectPreparedQuery , PgEffectSession , PgEffectTransaction } from '~/pg-core/effect/session.ts' ;
@@ -46,7 +46,7 @@ export class EffectPgPreparedQuery<T extends PreparedQueryConfig, TIsRqbV2 exten
4646 super ( { sql : queryString , params } , cache , queryMetadata , cacheConfig ) ;
4747 }
4848
49- execute ( placeholderValues ?: Record < string , unknown > ) : Effect . Effect < T [ 'execute' ] , DrizzleQueryError > {
49+ execute ( placeholderValues ?: Record < string , unknown > ) : Effect . Effect < T [ 'execute' ] , TaggedDrizzleQueryError > {
5050 if ( this . isRqbV2Query ) return this . executeRqbV2 ( placeholderValues ) ;
5151
5252 const { query, logger, customResultMapper, fields, joinsNotNullableMap, client } = this ;
@@ -82,7 +82,7 @@ export class EffectPgPreparedQuery<T extends PreparedQueryConfig, TIsRqbV2 exten
8282
8383 private executeRqbV2 (
8484 placeholderValues ?: Record < string , unknown > ,
85- ) : Effect . Effect < T [ 'execute' ] , DrizzleQueryError > {
85+ ) : Effect . Effect < T [ 'execute' ] , TaggedDrizzleQueryError > {
8686 const { query, logger, customResultMapper, client } = this ;
8787 const params = fillPlaceholders ( query . params , placeholderValues ?? { } ) ;
8888
@@ -97,12 +97,12 @@ export class EffectPgPreparedQuery<T extends PreparedQueryConfig, TIsRqbV2 exten
9797 ) ,
9898 ) . pipe ( Effect . catchAll ( ( e ) => {
9999 // eslint-disable-next-line @drizzle-internal/no-instanceof
100- return Effect . fail ( new DrizzleQueryError ( query . sql , params , e instanceof Error ? e : undefined ) ) ;
100+ return Effect . fail ( new TaggedDrizzleQueryError ( query . sql , params , e instanceof Error ? e : undefined ) ) ;
101101 } ) )
102102 ) ;
103103 }
104104
105- override all ( placeholderValues ?: Record < string , unknown > ) : Effect . Effect < T [ 'all' ] , DrizzleQueryError , never > {
105+ override all ( placeholderValues ?: Record < string , unknown > ) : Effect . Effect < T [ 'all' ] , TaggedDrizzleQueryError , never > {
106106 const { query, logger, client } = this ;
107107 const params = fillPlaceholders ( query . params , placeholderValues ?? { } ) ;
108108
@@ -194,7 +194,7 @@ export class EffectPgSession<
194194 ) ;
195195 }
196196
197- override execute < T > ( query : SQL ) : Effect . Effect < T , DrizzleQueryError > {
197+ override execute < T > ( query : SQL ) : Effect . Effect < T , TaggedDrizzleQueryError > {
198198 return this . prepareQuery < PreparedQueryConfig & { execute : T } > (
199199 this . dialect . sqlToQuery ( query ) ,
200200 undefined ,
@@ -203,7 +203,7 @@ export class EffectPgSession<
203203 ) . execute ( ) ;
204204 }
205205
206- override all < T > ( query : SQL ) : Effect . Effect < T , DrizzleQueryError > {
206+ override all < T > ( query : SQL ) : Effect . Effect < T , TaggedDrizzleQueryError > {
207207 return this . prepareQuery < PreparedQueryConfig & { all : T } > (
208208 this . dialect . sqlToQuery ( query ) ,
209209 undefined ,
@@ -224,8 +224,8 @@ export class EffectPgSession<
224224 TRelations ,
225225 TSchema
226226 > ,
227- ) => Effect . Effect < T , DrizzleQueryError | TransactionRollbackError , never > ,
228- ) : Effect . Effect < T , DrizzleQueryError | TransactionRollbackError , never > {
227+ ) => Effect . Effect < T , TaggedDrizzleQueryError | TaggedTransactionRollbackError , never > ,
228+ ) : Effect . Effect < T , TaggedDrizzleQueryError | TaggedTransactionRollbackError , never > {
229229 const { dialect, relations, schema } = this ;
230230 const session = this ;
231231
@@ -238,7 +238,7 @@ export class EffectPgSession<
238238 ) ;
239239
240240 return yield * transaction ( tx ) ;
241- } ) ) ;
241+ } ) ) as Effect . Effect < T , TaggedDrizzleQueryError | TaggedTransactionRollbackError , never > ;
242242 }
243243}
244244
@@ -253,8 +253,8 @@ export class EffectPgTransaction<
253253 override transaction < T > (
254254 transaction : (
255255 tx : PgEffectTransaction < TQueryResult , TFullSchema , TRelations , TSchema > ,
256- ) => Effect . Effect < T , DrizzleQueryError | TransactionRollbackError , never > ,
257- ) : Effect . Effect < T , DrizzleQueryError | TransactionRollbackError , never > {
256+ ) => Effect . Effect < T , TaggedDrizzleQueryError | TaggedTransactionRollbackError , never > ,
257+ ) : Effect . Effect < T , TaggedDrizzleQueryError | TaggedTransactionRollbackError , never > {
258258 return this . session . transaction ( transaction ) ;
259259 }
260260}
0 commit comments