Roc – A fast, friendly, functional language
If the task returned by the previous step in the pipeline fails, pass its error to handleErr. As with all the other lines ending in |> Task.await, if there's an error, nothing else in storeEmail will be run, and handleErr will end up handling the error. Each line does a pattern match on the shape of the error to decide whether to run, or to move on and try the next line's pattern. Roc will do compile-time exhaustiveness checking and tell you if you forgot to handle any error cases here that could have occurred, based on the tasks that were run in storeEmail. If we wanted to print more detail about what the error was, we'd name that something other than and actually use it. The is where more information about the error is stored in the FileReadErr. The is where more information about the error is stored in the FileWriteErr.