Handling "Option" in Effect: Is using "andThen" to unwrap a smell?
Quick beginner question related to "Option" handling:
I have an effect with the type Effect<Option<User>, CustomError1 | CustomError2, never>
Then up-stream i use "andThen" to unwrap that Option and move the Option.None to the error channel (NoSuchElementException).
I was wondering, is that a smell? Would it make more sense to only operate on the error channel to begin with by creating a custom not-found-error, and just avoid Option altogether?
Much appreciated!
I have an effect with the type Effect<Option<User>, CustomError1 | CustomError2, never>
Then up-stream i use "andThen" to unwrap that Option and move the Option.None to the error channel (NoSuchElementException).
I was wondering, is that a smell? Would it make more sense to only operate on the error channel to begin with by creating a custom not-found-error, and just avoid Option altogether?
Much appreciated!
