Composable errors and type safety #1332
JacksonUtsch
started this conversation in
Beta
Replies: 1 comment 12 replies
-
If this direction is not taken, what are we supposed to do with global errors that we want to present the user? These are unable to be propagated from features. |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Here I am, a broken record. I'm looking for method to modularize error handling and have it be type safe. This is generally done with the
Result
type in Swift, as throws are untyped.Why would we want type safe errors and for them to be modular? Exhaustive applications! Without such, how are we to handle unexpected error cases? Type safety allows us to understand potential errors and appropriately deal with each case as need be. We can even easily create user or developer facing associated messages.
With the new
ReducerProtocol
I considered the option of using theResult
type as theAction
. I thought it would work out better than it did. There are consequences of doing so, like having to handle error cases in each reducer rather than composing the reducers. It gets a little messy.If
Error
types are opted into theReducerProtocol
type then composition can take place where errors can be propagated through feature domains and handled globally where some or most errors can't be handled locally in their feature domain.Here is my brief testing with from protocol branch
Episode 196 talks about the error situation some
Beta Was this translation helpful? Give feedback.
All reactions