Where do you put the setting?
I put it an onException in the main.cfc
Do I put a view to the exception in there?
Can I send a email from there?
Is there a working example somewhere? I did not notice any inside the sample code.
Hi Nathan,
Below is my Main.cfc onException function. This could be a bit overkill, but I use both Logbox and Aaron Greenlee’s HOTH - http://aarongreenlee.com/share/hoth-coldfusion-errors-tracking-reporting/
to track and log the errors. Both of which are setup to email me the errors.
In addition I use cfsavecontent to display a friendly error message to the user.
Kudos go to Aaron for the code below. Hope this helps.
Nolan
var rc = event.getCollection(); var prc = event.getCollection(private=true);//log to HOTH
local.HothTracker = (structKeyExists(application, ‘HothTracker’))
? application.HothTracker
: new Hoth.HothTracker( new platform.common.config.HothConfig() );
try {
//Grab Exception From request collection, placed by ColdBox
local.ExceptionBean = Event.getValue(“ExceptionBean”);
//log to logbox
if( log.canFatal() ){
log.fatal(’#cgi.http_host# - Main.onException, detail - #local.ExceptionBean.getDetail()#, message - #local.ExceptionBean.getMessage()#’,local.ExceptionBean.getStacktrace());
}
} catch (any e) {
// Record that the exception bean was not found!
// This should also provide the context of the original error
// however, the error details will be different. This is important
// in the event ColdBox has an issue capturing the error.
local.HothTracker.track(e);
return;
}
local.HothTracker.track(local.ExceptionBean);
savecontent variable=“local.e” {
include ‘…/views/500.cfm’;
}
writeOutput(local.e);
Thanks I will try this out in my main.cfc - that is where it should be correct.
What all do you need just to download hoth? and setup code in main.cfc
Is this true?
missingTemplateHandler = “main.onMissingTemplate”,
If a missing file exists it will call the main.onMissingTemplate
exceptionHandler = “main.onException”,
If an exception occurs it will call the main.onException
onInvalidEvent = “main.pageNotFound”,
If a event is not found it will call the main.pageNotFound
customErrorTemplate = “views/errors/generic_error.cfm”,
If a error occurs the page that will be displayed will be views/errors/generic_error.cfm
I am using ColdBox 3.1
bugTracers =
{
enabled = true,
bugEmails = “xxx@xxx”,
mailFrom = “xxx@xxx”,
customEmailBugReport = “”
};
My understanding is that bugTracers has been replaced by using LogBox is this correct?
- When we get errors they are not always clear as to what it wrong…
Example:
MissingInclude
Message
Could not find the included template /awng/views/myaccount/personalinfo.cfm
Yet when I go further down into the ColdFusion Exceptions area I get these two errors the first being the error. This still is not very clear as to what is wrong.
Exceptions
11:58:45.045 - Database Exception - in C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\CustomTags\com\adobe\coldfusion\base.cfc : line 364
Error Executing Database Query.
11:58:45.045 - MissingInclude Exception - in D:\apache\htdocs\ColdBox\system\plugins\Renderer.cfc : line 271
Could not find the included template /awng/views/myaccount/personalinfo.cfm.
If I take a new folder and create a simple application.cfm and index.cfm and call the objects in the handler I get a clearer picture as to what might be wrong with the object or query.
How can I get ColdBox to give me that information using LogBox in an email and display a nice error to the customer?
Can someone give me a one or two page example... like the sample apps. Create a new ColdBox App with the Advanced Template and change whatever is needed to be changed to setup ColdBox 3.1 error handling to work. Then cause a simple bad select or bad insert query and any other exception they want to show. I would be very grateful. I have been working on this over and over again.
Thanks for anyone's help.
Brad I appreciate the work you are doing to help me get an example. This is a new application and there are no try catches in this area. I made sure since we all are wanting better errors. So I am trying to get as much info as I can. I am trying what you gave me. I got the file working to display to the customer… just not sure I am getting enough information related tot he error.