Try Catch Exception Screenshot

I put my bot in a try catch sequence. If an exception is thrown it logs the message and sends me an email with the log. However, it would be nice to add a screenshot. I have not used the Take screenshot activity yet. But I added it to the exception sequence before log message and I made the output a variable. Is there a way I can put the screenshot in the body of the exception email or as an attachment?

If you have the screenshot saved as a file you can pipe that file into your email as an attachment.

To send it embedded in the message depends on the method you’re using as it’s different for smtp vs exchange.

I tried the save image for the screenshot but I am getting an error that it does not recognize the file path. I have the screenshot saved as a variable. Can I not just attach the variable? Do I have to save it first and then attach what I saved? I am not sure if this is necessary, I am just thinking what would be best in my error email.

I typically try to simply first. If you can save the screenshot as a file first and email it to yourself then you can try to send the screenshot directly. Are you sure you’re even getting a screenshot right now?

1 Like

Good point. I am not sure if I am event getting the screenshot. I will work on that first.

You were correct. I tried a simple file path and the save worked fine. So I fixed the issue with the file path and now it is attaching the error screenshot. Thanks!

Glad I could help!

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