how to handle this type of errors with try catch please guid me
Why do you need to handle it as a try…catch? Can’t you handle it with an Element Exists or Check App State activity instead? Or can’t you simply validate the data upfront, so that you can throw a business exception before writing in the cell?
I suggest avoiding Try/Catch to handle local errors like this. It’s better to use booleans and conditions to check the values or state of the app before moving forward in the process. And, if it’s an issue with the value coming in, then it’s likely a BusinessException, so a Throw activity, might be a good approach to end the transaction.
You should explore using TryParse or Regex.Match().Success as a condition to check that the value is in the correct format, since it requires the value to be in the regex format:
^[0-9]+h$
…or something like that
@imumeriqbal Before going to write value, check its format by regex or any other option.
If the format is not correct than throw Business Exception as.
New BusinessException(“Format of Specific value is not valid”)
Then put try catch in whole workflow and in catch block make one businesses Exception and Use “Rethrow” activity. Rethrow will throw your previous exception outside the workflow.
After writing the value you can use check app state or element exists activity to check for the error message and if present throw an error
Cheers
you mean i need to put check app state upto all activities