Lukáš Kúšik
08/12/2022, 9:46 AMRepository
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