import { Effect } from "effect";
export const getTodoById = (id: string) =>
Effect.gen(function* () {
const todoService = yield* TodoService;
const todo = yield* todoService.getTodoById("some-id");
if (todo.description.length < 2) {
yield* Effect.fail(new ValidationError("Too small description"));
}
return todo;
});
import { Effect } from "effect";
export const getTodoById = (id: string) =>
Effect.gen(function* () {
const todoService = yield* TodoService;
const todo = yield* todoService.getTodoById("some-id");
if (todo.description.length < 2) {
yield* Effect.fail(new ValidationError("Too small description"));
}
return todo;
});