Action.Try
Action.Try(action as action) as action
Creates an action that executes action, catches any errors that occur while executing the action, and returns a record containing a HasError field and either a Value or Error field depending on whether the action executed successfully.
Creates an action that will try the execution of a second action that throws an error. The result of the Try action is the error record:
[HasError = true, Error = [Reason = "Expression.Error", Message = "Error!", Detail = null]
Action.Try(Action.Sequence({() => Action.Return(error "Error!")}))
action
Creates an action that will try the execution of a second action that returns a result. The result of the Try action is a success record:
[HasError = false, Value = "Success!"]
Action.Try(Action.Sequence({() => Action.Return("Success!")}))
action