hi friends, i one method, that method contains more than 10 child methods with async, i would like to capture the exceptions from child in parent method, just see the my code for clearance
public static class StateMachineCommand
{
///
/// Creates a DelegateCommand using a trigger and a state machine.
/// The command can be executed if the trigger can be executed on the current state machine status and the specified "CanExecute" function is null or returns true.
/// When the command is executed the specified action is executed and then the trigger is fired
///
/// State machine status type.
/// State machine status trigger.
/// A state machine instance
/// A trigger.
/// Action to execute when the command is executed.
/// The command can be executed only if this function is null or return true and the current status of the machine supports the trigger.
public static DelegateCommand CreateCommand(this StateMachine stateMachine, TTrigger trigger, Action execute = null, Func canExecute = null)
{
if (canExecute == null)
{
canExecute = () => true;
}
if (execute == null)
{
execute = () => { };
}
return new DelegateCommand(
executeMethod: () =>
{
execute(); ----->here am excuting all child methods and it's will not return any value and it's all async, if any error i caught here means i need to stop the following code whichever mentioned in green color
if (stateMachine.CanFire(trigger))
{
stateMachine.Fire(trigger);
}
},
canExecuteMethod: () => canExecute());
}
thanks in advance

Shweta LodhaPosted Jul 11, 2017, 3:09 AM
Gnanavel SekarPosted Jul 17, 2017, 7:24 AM
Gnanavel SekarPosted Jul 17, 2017, 6:52 AM
Gnanavel SekarPosted Jul 11, 2017, 3:15 AM