Zach Klippenstein (he/him) [MOD]
04/23/2021, 2:30 PMthanksforallthefish
04/23/2021, 2:34 PMEither
is a pretty useful concept, but it still means each node of the chain has to explicitly handle the error case and in practice I find myself most often than not in need to simply forward the error. and when that is the case, exception is more straightforward waythanksforallthefish
04/23/2021, 2:35 PMZach Klippenstein (he/him) [MOD]
04/23/2021, 2:36 PMthanksforallthefish
04/23/2021, 2:39 PMchristophsturm
04/23/2021, 2:40 PMchristophsturm
04/23/2021, 2:43 PMchristophsturm
04/23/2021, 2:47 PMMichael Böiers
04/23/2021, 2:48 PMchristophsturm
04/23/2021, 2:49 PMchristophsturm
04/23/2021, 2:50 PMchristophsturm
04/23/2021, 2:55 PMZach Klippenstein (he/him) [MOD]
04/23/2021, 2:58 PMZach Klippenstein (he/him) [MOD]
04/23/2021, 3:00 PMchristophsturm
04/23/2021, 3:13 PMRoukanken
04/23/2021, 5:37 PMtoInt()
and toIntOrNull()
to take example on HTTP client, fetch()
, returning sealed class of HttpError responses (so client can choose which to handle with with
, and which to bubble up with else
branch in it). And second fetchOrThrow()
which would simply throw everything, to be used when client simply expect result everytime. (Names to be changed)
or if you think client needs more decision precision than just HTTP codes, then you would have to write some DLS to match them or smth... that sadly wouldn't be that pretty I think.