function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CustomDataIntegrationsCustomDataIntegrations 

Exception Handling - Show Custom Page & Throw Error

How do I go about showing a generic "An Error Happened" page and still get the error to be thrown so that I still recieve an email about the error and what happened?

Rahul SharmaRahul Sharma

You could implement it using try catch block, In catch write additional code to redirect user to error page as well as email the appropriate for the notification.

I think instead of redirecting user to another error page, You better show user friendly page messages.

CustomDataIntegrationsCustomDataIntegrations

Currently, when an error is thrown, there is an email that automatically goes out.  Thinking about that, when a user downloads the app from the app exchange and they encounter an error, would that error email still come to me or does it go to the admin of that user?

 

What is the best way for generating the email and sending it from SalesForce?  Basically I want an email to come to me with the Stack Trace information so that I can address the issue or track what is going on with the application as people are downloading and using it.

Rahul SharmaRahul Sharma
I don't think using above you would receive any notification error when users install your application in their org.
But you could write pre/post installation script in test class, and implement try catch & email functionality over there to mail the error to yourself.

We can write email service in apex but not sure if that's best way in your scenario. So I would suggest you to try contacting Salesforce(by logging in a case), they could provide you the best solution.