I wrote a thing for the company blog:
Seriously, though, displaying a stack trace to your users is poor form. It's the web site equivalent of the Windows "Blue Screen of Death". However stack traces are useful diagnostics tools for the developer or DevOps team.
Frequently they occur in unexpected circumstances -- database down, disk full, disk not writeable, disk error, network failure, etc. Even in the most trying of circumstances try to log something useful somewhere (be aware that your normal logging procedure may not work, so have a fallback), and try to display something less unfriendly to the user, such as redirecting them to a "maintenance" page or server status blog. Try to keep your customers informed -- don't just leave them hanging. Status blogs are good practice because it may be some time before your networks, systems or DevOps teams have the problem diagnosed and resolved.