Hi! I am trying to model the error handling in our...
# arrow
l
Hi! I am trying to model the error handling in our Android client. I have been inspired by this video

(1) Building applications with Kotlin and Arrow.kt in style - YouTube

, although I would like to apply these principles to the client side in this case. Let's say that there's a
Repository
which uses a
RemoteApi
and I'd like to create a new user on the backend. The
RemoteApi
does the POST call using Ktor, and returns the result of the
Either<ApiError, UserDTO>
type, where
ApiError
encapsules any network exceptions, internal server errors, etc. Now, I would like to parse expected errors (like
UserAlreadyExists
) as
UserError
of the common
DomainError
sealed type (similar to the video). I'd like the
Repository
to get the`Either<ApiError, UserDTO>` from the
RemoteApi
, process the known errors and return something like the
Either<UserError, UserDTO>
type. The problem with
Either<UserError, UserDTO>
is, that