littlelightcz
07/28/2018, 10:18 AMrunCatching
feature and I am thinking about this use case: You want to process a list of files and after that you want to do a report about which file names succeeded and which didn't + what was the failure cause for each of them (or maybe possibly group failed file names by the same error etc.). Since now the Failure class contains only the exception, you lose the information for which original value it failed. Would it be possible to extend the Failure class to contain the failed value as well or is there a better way how to solve this use case?littlelightcz
07/28/2018, 10:23 AMmapSuccessful()
which could do mapNotNull { it.getOrNull() }
etc.gildor
07/28/2018, 12:46 PMgildor
07/28/2018, 12:47 PMgildor
07/28/2018, 12:48 PMlittlelightcz
07/28/2018, 4:42 PMgildor
07/28/2018, 4:49 PMgildor
07/28/2018, 4:50 PMgildor
07/28/2018, 4:52 PMlittlelightcz
07/28/2018, 8:18 PMgildor
07/29/2018, 3:46 AMvalue
, because it’s result of some operation and you not always have value as argument)louiscad
07/29/2018, 7:47 AMlittlelightcz
07/29/2018, 10:36 AMrunCatching {}
fails, there is never a value returned. Probably the only option would be to call it like runCatching(originalValue) {}
, but that's weird indeed. Ok, I think I will be good with the Pair/Map solution 😄.