Hello! I understand that `Try` is deprecated and g...
# arrow
a
Hello! I understand that
Try
is deprecated and going away, but what would be the most clear fix of this code:
Copy code
fun extractUserInfo(userInfoData: String): Either<AppError, UserInfo> =
    Try { createKlaxon().parse<UserInfo>(userInfoData) }
        .toEither { AppError.UserDataJsonParseFailed("Couldn't parse") }
        .leftIfNull { AppError.UserDataJsonParseFailed("Parsed result is null") }
Using
try
catch
is doable, but painful to look at. The documentation still has reference of
Try
, but not what to do when I want to replace it with something else.