Using @tim-smart/openapi-gen with a Custom HTTP Client and Error Handling

has anyone used the @tim-smart/openapi-gen library? Ideally I'd like to use it with a custom httpclient which may throw custom errors. I'm not sure if that kind of thing is supported, or if the way I'm designing this is completely backwards.

Here's a playground example with the full code: https://effect.website/play/#af62c7ce2e58

The type errors I get are due to the additional error type in my client

const program = Effect.gen(function*() {  
  // FooHttpClient gets a token for each request, and may fail with a token error.

  // // Type 'Effect<HttpClientResponse, Oopsie | HttpClientError, never>'
  // // is not assignable to
  // // type 'Effect<HttpClientResponse, HttpClientError, never>'
  const client = Generated.make(yield* FooHttpClient)

  const response = yield* client.apiV2AbilityList()

  console.log(response.results)
})
Was this page helpful?