Stylianos Gakis
12/22/2021, 12:13 PMclass SomeUseCase(//dependencies) {
sealed class Error {
object NetworkError : Error()
object NoResultFound : Error()
}
sealed class Success {
object OneSuccess : Success()
object TwoSuccess : Success()
}
suspend operator fun invoke(): Either<Error, Success> {//code}
}
Where each out of many use cases may have their own domain error/success cases but then we have Success
or Error
pollute the entire code-base namespace which makes it a bit annoying to work with.
I know the internal
modifier exists but for various reasons we can’t just modularize our codebase, at least not instantaneously.
In Java I’d slap a package private in there and call it a day, does anyone have any tips on how to model this nicer?