Retry Indefinitely with Bail on Specific Error Variant

Hey! I would like to retry indefinitely but bail on a particular unrecoverable error variant. Seems that effect could narrow the error variant to just that one. Thoughts?

Effect.retry({
  schedule: Schedule.jittered(Schedule.exponential("10 millis")),
  until: (error) => error instanceof InvalidTokenError,
}),
// this seems pretty pointless!
Effect.mapError((error) => error as InvalidTokenError),


The signature of util is error is InvalidTokenError
Was this page helpful?