function onException(event,rc,prc){
//Grab Exception From request collection, placed by ColdBox
var exceptionBean = event.getValue("ExceptionBean");
if (NOT isDebugMode()) {
var Exception = exceptionBean;
var bugreport= "";
savecontent variable="bugreport" {
include "/coldbox/system/includes/BugReport.cfm";
}
//Place exception handler below:
dblogger.error("MESSAGE:#exceptionBean.getExceptionStruct().message#, DETAIL:#exceptionBean.getExceptionStruct().detail#",exceptionBean);
emaillogger.error("MESSAGE:#exceptionBean.getExceptionStruct().message#, DETAIL:#exceptionBean.getExceptionStruct().detail#",bugreport);
//location(url='/site-error', addToken='false');
}
}
/**
* On Error
*/
function onError(event,faultAction,exception,eventArguments){
// prepare a data packet
var data = {
status = false,
error = 'An error occurred. Please try again. If the problem persists please notify the system administrator.'
};
if (arguments.faultAction == 'create'){
data['error'] = 'An error occurred while creating the work request. Please try again. If the problem persists please notify the system administrator.';
}else if (arguments.faultAction == 'createNote'){
data['error'] = 'An error occurred while creating the work request note. Please try again. If the problem persists please notify the system administrator.';
}
var exceptionmessage = "#arguments.exception.message# & #arguments.exception.detail#";
// log via the log variable already prepared by ColdBox
log.error("Exception when executing #arguments.faultAction# #exceptionmessage#", arguments.exception);
// render out a json packet according to specs status codes and messages
event.renderData(data=data,type="json",statusCode=400,statusMessage="Error Occurred");
}
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/5ece482e-3733-47e3-8d82-7d61c6dce820%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
arguments
arguments.prc.exception
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/f3bf01b5-512c-42ff-bfdb-19a215d6ca40%40googlegroups.com.
/coldbox/system/includes/BugReport.cfm. However, that template assumes the exception was set in the object coldbox.system.web.context.ExceptionBean. In order to reuse the template I has to initialize and set the exception data in the object coldbox.system.web.context.ExceptionBean. Below was the code I ended up writing.
var exceptionBean = createObject("component","coldbox.system.web.context.ExceptionBean").init(errorStruct=arguments.exception,extramessage=arguments.extramessage,errorType=arguments.errorType);
var bugreport= "";savecontent variable="bugreport" { include "/vims/views/handlerBugReport.cfm";
}//Place exception handler below:dblogger.error("MESSAGE:#exceptionBean.getExceptionStruct().message#, DETAIL:#exceptionBean.getExceptionStruct().detail#",exceptionBean);emaillogger.error("MESSAGE:#exceptionBean.getExceptionStruct().message#, DETAIL:#exceptionBean.getExceptionStruct().detail#",bugreport);
This discussion definitely helped me to think outside the box. Thank you all for your help.
Jae