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).