Jimmy Alvarez
06/09/2021, 1:56 AMEither.catch {}
on some network calls, one comment was that using a try/catch
is more explicit. how could you sell the idea that Either.catch {}
is better than usual try/catch
.
For me, the way it looks y just clean, but they think the other way, for them is more clear an imperative style.
I don’t wanna get back to try/catch
😂gildor
06/09/2021, 3:44 AMgildor
06/09/2021, 3:45 AMBenoît
06/09/2021, 7:36 AMgildor
06/09/2021, 7:48 AMJimmy Alvarez
06/09/2021, 1:14 PMEither.catch {}
to a controller where the Either.fold is applied over.Jimmy Alvarez
06/09/2021, 1:15 PMfun getIdsFromUsersWithoutAlternatives2fa(): Either<ApiError, List<String>> = Either.catch {
val query = GET_USER_ID_FROM_USERS_WITHOUT_ALTERNATIVE_2FA
val queryExecutionId = submitAthenaQuery(query)
waitForQueryToComplete(queryExecutionId)
processQueryResult(queryExecutionId)
}.mapLeft { error -> ApiError("Error occurred while querying athena", cause = error as Exception) }
gildor
06/09/2021, 3:34 PMBenoît
06/09/2021, 4:41 PM