Try catch inside the Catch block?

Hi Everyone,

I am facing issue with the screenshot

i have used -try n catch blocks.
In try i have kept following code


In catch i have kept the following code.

But i am getting the following - run time error.
image
So what should i be doing to handle this?

Can i add the try catch again the catch block???

NOTE: I am having many sequences with the same catch block.

Please help

2 Likes

while mention the filepath in SAVE IMAGE activity we need to include the file extension as well like
“yourfolderpath/yourfilename.png”

Cheers @Seem

1 Like

Right!

@Seem : If you wanna handle it, I would recommend to make xaml of those activities in catch block and invoke it and use Try-Catch inside that xaml.

@Palaniyappan

The extension is added.

1 Like

fine
is the folder path valid
copy the same and check in file explorer once
@Seem

yes its valid
I am sharing a xaml file below.
with one sequence…

xyz.xaml (42.4 KB)

1 Like

Planning to keep thosse screen shots in the Try block
I am no sure its okay or not???

i saw the xaml
willl this . comes along the folder name
image

Cheers @Seem

yeah, the .screenshots.
The DOT will come in the screenshots… thats just a folder name

i think that is why this error comes @Seem
can i see that folder from file explorer if possible with a screenshot
@Seem

yeah
image

place the folder in some other path and try with that path in save image once
just for confirmation
@Seem

You have the filename hardcoded. It could be failing because the file already exists. You should generate the filename at runtime (with an assign just before the save image) with something like…

folderPath + “Exception_” + Now.ToString(“MM_dd_yyyy_hh_mm_ss”) + “.png”

This will get you a unique filename unless you’re also generating multiple exception screenshots within 1 second of each other.