I know that I can override the standard error pages for a Force.com Site (Not Found, In Maintenance, Generic Error) with my own Visualforce pages and controller.

However, what I don't know how to do is find out what the root cause is for the Generic Error that is causing me to arrive at the page.

For example, if I haven't authorized one of the VF Pages that makes up my site to the Sites Guest User (via Profile or Permission Set), you land on the "http://xyz-developer-edition.na16.force.com/ticket is under construction. Stay tuned. Please email us if you need to get in touch." page.

But how do I know that the reason I'm on the Generic Error page is because of that specific problem?

My goal is to add a VF controller to the error page and email an administrator with a detailed explanation of the problem (and tips on how to resolve it).

2 Answers 2


After a long and laborious Case with Support, the conclusion is that there is no way to do what's suggested in the Question.

Any unhandled exception in a VF page served from Force.com Sites results in a 401/Unauthorized which is handled by the VF page configured as the "Unauthorized" handler in the Sites configuration.

If you add a Controller to this page and set an action on the page which invokes a method like so:

public class ErrorController{
    public PageReference landingAction(){
        System.debug('ERROR MESSAGE: ' + Site.getErrorMessage());
        System.debug('ERROR DESCRIPTION: ' + Site.getErrorDescription());
        return null;

The ERROR MESSAGE is "Login is required to access this URL."

This is not correct, but according to Support, this is "working as designed" and as such, is completely useless.


Try passing a parameter to the Generic Error page and and retrieve the parameter and see in that page. I haven't tried it, but you can test it quickly.

  • I don't think you understand how the error pages work -- they're loaded by the platform when an error occurs -- not directly via an URL
    – daveespo
    Commented Jul 21, 2015 at 10:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .