How to correctly Handle: Only activities which have been requested to cancel can call MarkCanceled

Hi All,

I have a lot of automations that use the GSuite Activity and on average I would say I get 2 of these errors each day:

Only activities which have been requested to cancel can call MarkCanceled. Check ActivityInstance.HasCancelBeenRequested before calling this method

The issue occurs when ever the automation tries to Read or Write to Google Sheets via the GSuite Activity package.

I have read in another post it is likely due to an underlying network blip or the Google API having a moment and to mitigate it a Retry Scope should be used.

My question is - What condition am I looking for in the Retry Scope. Initially I thought this was a very simple fix, but the problem I have is the block of code is surrounding with a Try/Catch (as the error is being surfaced via the Catch) but for the Retry Scope, I have made the assumption that this will be done in the TRY, so at this point I do not know how to address the Exception?

The logic I was thinking was Retry 3 times with a 2 second delay in between each retry, whilst there is an exception and if after the 3rd try there is still an exception I will THROW an exception to catch. I will need to tick the ‘Continue on Error’ tick box on the retry scope so that it doesn’t respond to the error if it happens BUT I cannot work out what to put into the Condition of the Retry Scope.

Any advice or help would be appreciated

Hi, ignore the Condition scope. At first it got me confused as well. Just put the workflows you would like into Retry scope with x amount of time and x amount of interval. If any errors occur it will retry. Please try it and let me know if it worked or not. You don’t need a condition to trigger the Retry scope.

Thanks,
Thrall

Worked Perfectly! I totally lost sight of the fact that I could it without a condition! Thankyou for reminding me that things don’t always have to be really complex and difficult!

Glad that it worked and helped you to move forward in your automation development :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.