Handling Errors
Code
val doThings: WIO[MyState, MyError, Nothing] =
WIO.raise[MyState](MyError()).autoNamed()
val handleThatNastyError: WIO[(MyState, MyError), Nothing, MyState] =
WIO.pure[(MyState, MyError)](MyState(1)).autoNamed()
val errorHandled: WIO[MyState, Nothing, MyState] =
doThings.handleErrorWith(handleThatNastyError)
BPMN
Model
{
"base" : {
"name" : "Do Things",
"error" : {
"name" : "My Error"
},
"_type" : "Pure"
},
"handler" : {
"name" : "Handle That Nasty Error",
"error" : null,
"_type" : "Pure"
},
"error" : {
"name" : "My Error"
},
"_type" : "HandleError"
}