How to Specify a Custom Error Type in RequestResolver

The code below has a result of RequestResolver.RequestResolver<AccountReadById, never> which I need RequestResolver.RequestResolver<AccountReadById, AccountErrorNotFound>. What should I do ?
export class AccountReadById extends Schema.TaggedRequest<AccountReadById>("AccountReadById")("AccountReadById", {
  failure: AccountErrorNotFound,
  payload: { id: AccountId },
  success: Account
}) {
  [PrimaryKey.symbol]() {
    return `AccountReadById:${this.id}`
  }
}

export const makeAccountReadResolver = Effect.gen(function*() {
  const { cacheTTLMs } = yield* AccountConfig
  const driven = yield* AccountPortDriven
  const resolver = yield* RequestResolver.fromEffectTagged<AccountReadById>()({
    AccountReadById: (requests) =>
      driven.readByIds(requests.map((req) => req.id)).pipe(
        Effect.withSpan("AccountUseCase", {
          attributes: { [ATTR_CODE_FUNCTION_NAME]: "AccountReadById", requests }
        }),
        Effect.tap(() => logDebugWithTrace(`DB hit: AccountReadById ${requests.length}`))
      )
  }).pipe(
    persisted({
      storeId: "Account",
      timeToLive: (_req, exit) => Exit.isSuccess(exit) ? cacheTTLMs : 0
    })
  )

  return resolver
})
Was this page helpful?