I am trying to create a global error message that displays a clean error message (for all website on the server) AND send me an email with the error dump. Any thoughts? Thank you in advance for your help.
OnError in application.cfc
Firstly, don’t email errors, use a tool to collect error reports in a manageable way like Sentry (https://sentry.io/welcome/), Raygun (https://raygun.com/) or if you want a CFML-based solution BugLogHQ https://github.com/oarevalo/BugLogHQ). This will make it far easier to manage the issues and see which are the most important, etc…
Secondly, there is no way to do this at the “server” level for all websites, you would have to implement the OnError in your Application.cfc’s on each site, as @Lance_Lake suggested.
I second BugLogHQ and RayGun. I’m pretty certain there’s a LogBox appender for each of those to make it easier to integrate. I also think BugLogHQ will do a direct E-mail to you if it can’t contact the BugLog server which is nice.
There are good 3rd party solutions for handling errors. I personally like BugSnag (https://www.bugsnag.com/). Error details are captured using OnError in application.cfc. Error details passed in an JSON object via cfhttp to https://notify.bugsnag.com. BugSnag provides the management interface. You can choose how errors are reported to you (email, etc.)