| 67 | |
| 68 | // @effect-diagnostics-next-line missingEffectServiceDependency:off |
| 69 | class MyContextProviderGen extends Context.Service<MyContextProviderGen>()( |
| 70 | "MyContextProviderGen", |
| 71 | { |
| 72 | make: Effect.gen(function*() { |
| 73 | yield* SomeService |
| 74 | if (Math.random() > 0.5) return yield* new CustomError1() |
| 75 | |
| 76 | return function*() { |
| 77 | // the only requirements you can have are the one provided by HttpLayerRouter.Provided |
| 78 | yield* Scope.Scope |
| 79 | |
| 80 | yield* Effect.logInfo("MyContextProviderGen", "this is a generator") |
| 81 | yield* Effect.succeed("this is a generator") |
| 82 | |
| 83 | return Some.context({ a: 1 }) |
| 84 | } |
| 85 | }) |
| 86 | } |
| 87 | ) { |
| 88 | static readonly Default = Layer.effect(this, this.make) |
| 89 | } |
| 90 | |
| 91 | export const someContextProvider = ContextProvider({ |
| 92 | effect: Effect.gen(function*() { |