I have a custom exception engine that catches an exceptions, emails details about the exception to me, and then renders a friendly error page. What I would really like to do is to be able to grab a screenshot of the page where the error occurred and attach it to the email.
The problem I have been running into is that the page I want to screenshot is technically the page previous to the current request. So when I have tried inspecting the env
hash on an exception, it appears to only have information related to the exception, not the previous page. So if I call render_to_string
and use the HTML to generate a screenshot, it ends up being a shot of the friendly error page, rather than the referer page.
Is this possible?
And if it is possible, will it get the page with any JavaScript that was running? For example, if a user opened a JS modal on a page and then got an exception when clicking something inside the modal, I would want the screenshot showing the modal.