Combine framework tutorial - Part 3 - Error handling with mapError, setFailureType, & flatMap

preview_player
Показать описание
This tutorial will show you how errors are included in the Combine framework. Error handling is important otherwise your data streams will complete and data processing they are supposed to handle will stop. This results in an UI that is no longer responsive.

Overview:
00:00 intro
01:52 setFailureType(to)
04:26 mapError
10:16 retry when error occurs
11:54 catch errors

This is the 3 part of the series. You can find the others here:

If you liked what you learned and you want to see more, check out one of my courses!

#CombineFramework #Errorhandling
Рекомендации по теме
Комментарии
Автор

Thank you very much for the tutorial! It is very explanatory. It could be really good to watch a whole video devoted not only to error handling operators but error handling strategy. For sure it’s quite a big topic but an example of handling 3-4 different kinds of errors will be already a good one 😊

andronisaev
Автор

Tiny shortcut for checking the type of error and then casting to it:

static func convert(error: Error) -> APIError {
switch error {
case let error as URLError:
return .url(error)
case let error as APIError:
return error
default:
return .unknown(error)
}
}

wukerplank