1- import { DisplayProperty } from "@systemfsoftware/trigger.dev_core" ;
2- import { ErrorWithStack , SchemaError , type ServerTask } from "@systemfsoftware/trigger.dev_core" ;
1+ import { type DisplayProperty } from "@systemfsoftware/trigger.dev_core" ;
2+ import { type ErrorWithStack , type SchemaError , type ServerTask } from "@systemfsoftware/trigger.dev_core" ;
33import { Data } from "effect" ;
44
55export class ResumeWithTaskError extends Data . TaggedError ( "ResumeWithTaskError" ) < {
6- task : ServerTask ;
6+ readonly task : ServerTask ;
77} > {
8- constructor ( readonly task : ServerTask ) {
8+ constructor ( task : ServerTask ) {
99 super ( { task } ) ;
1010 }
1111}
1212
1313export class ResumeWithParallelTaskError extends Data . TaggedError ( "ResumeWithTaskError" ) < {
14- task : ServerTask ;
15- childErrors : ReadonlyArray < TriggerInternalError > ;
14+ readonly task : ServerTask ;
15+ readonly childErrors : ReadonlyArray < TriggerInternalError > ;
1616} > {
1717 constructor (
18- readonly task : ServerTask ,
19- readonly childErrors : ReadonlyArray < TriggerInternalError >
18+ task : ServerTask ,
19+ childErrors : ReadonlyArray < TriggerInternalError >
2020 ) {
2121 super ( { task, childErrors } ) ;
2222 }
2323}
2424
2525export class RetryWithTaskError extends Data . TaggedError ( "RetryWithTaskError" ) < {
26- cause : ErrorWithStack ;
27- task : ServerTask ;
28- retryAt : Date ;
26+ readonly cause : ErrorWithStack ;
27+ readonly task : ServerTask ;
28+ readonly retryAt : Date ;
2929} > {
3030 constructor (
31- readonly cause : ErrorWithStack ,
32- readonly task : ServerTask ,
33- readonly retryAt : Date
31+ cause : ErrorWithStack ,
32+ task : ServerTask ,
33+ retryAt : Date
3434 ) {
3535 super ( { cause, task, retryAt } ) ;
3636 }
3737}
3838
3939export class CanceledWithTaskError extends Data . TaggedError ( "CanceledWithTaskError" ) < {
40- task : ServerTask ;
40+ readonly task : ServerTask ;
4141} > {
42- constructor ( readonly task : ServerTask ) {
42+ constructor ( task : ServerTask ) {
4343 super ( { task } ) ;
4444 }
4545}
4646
4747export class YieldExecutionError extends Data . TaggedError ( "YieldExecutionError" ) < {
48- key : string ;
48+ readonly key : string ;
4949} > {
50- constructor ( readonly key : string ) {
50+ constructor ( key : string ) {
5151 super ( { key } ) ;
5252 }
5353}
5454
5555export class AutoYieldExecutionError extends Data . TaggedError ( "YieldExecutionError" ) < {
56- location : string ;
57- timeRemaining : number ;
58- timeElapsed : number ;
56+ readonly location : string ;
57+ readonly timeRemaining : number ;
58+ readonly timeElapsed : number ;
5959} > {
6060 constructor (
61- readonly location : string ,
62- readonly timeRemaining : number ,
63- readonly timeElapsed : number
61+ location : string ,
62+ timeRemaining : number ,
63+ timeElapsed : number
6464 ) {
6565 super ( { location, timeRemaining, timeElapsed } ) ;
6666 }
@@ -69,33 +69,33 @@ export class AutoYieldExecutionError extends Data.TaggedError("YieldExecutionErr
6969export class AutoYieldWithCompletedTaskExecutionError extends Data . TaggedError (
7070 "AutoYieldWithCompletedTaskExecutionError"
7171) < {
72- id : string ;
73- properties ?: DisplayProperty [ ] ;
74- data : { location : string ; timeRemaining : number ; timeElapsed : number } ;
75- output ?: string ;
72+ readonly id : string ;
73+ readonly properties ?: DisplayProperty [ ] ;
74+ readonly data : { location : string ; timeRemaining : number ; timeElapsed : number } ;
75+ readonly output ?: string ;
7676} > {
7777 constructor (
78- readonly id : string ,
79- readonly properties : DisplayProperty [ ] | undefined ,
80- readonly data : { location : string ; timeRemaining : number ; timeElapsed : number } ,
81- readonly output ?: string
78+ id : string ,
79+ properties : DisplayProperty [ ] | undefined ,
80+ data : { location : string ; timeRemaining : number ; timeElapsed : number } ,
81+ output ?: string
8282 ) {
8383 super ( { id, properties, data, output } ) ;
8484 }
8585}
8686
8787export class AutoYieldRateLimitError extends Data . TaggedError ( "AutoYieldRateLimitError" ) < {
88- resetAtTimestamp : number ;
88+ readonly resetAtTimestamp : number ;
8989} > {
90- constructor ( readonly resetAtTimestamp : number ) {
90+ constructor ( resetAtTimestamp : number ) {
9191 super ( { resetAtTimestamp } ) ;
9292 }
9393}
9494
9595export class ParsedPayloadSchemaError extends Data . TaggedError ( "ParsedPayloadSchemaError" ) < {
96- schemaErrors : ReadonlyArray < SchemaError > ;
96+ readonly schemaErrors : ReadonlyArray < SchemaError > ;
9797} > {
98- constructor ( readonly schemaErrors : ReadonlyArray < SchemaError > ) {
98+ constructor ( schemaErrors : ReadonlyArray < SchemaError > ) {
9999 super ( { schemaErrors } ) ;
100100 }
101101}
@@ -131,12 +131,12 @@ export function isTriggerError(err: unknown): err is TriggerInternalError {
131131
132132// This error isn't an internal error but it can be used by the user to figure out which task caused the error
133133export class ErrorWithTask extends Data . TaggedError ( "ErrorWithTask" ) < {
134- cause : ServerTask ;
135- message : string ;
134+ readonly cause : ServerTask ;
135+ readonly message : string ;
136136} > {
137137 constructor (
138- readonly cause : ServerTask ,
139- readonly message : string
138+ cause : ServerTask ,
139+ message : string
140140 ) {
141141 super ( { cause, message } ) ;
142142 }
0 commit comments