Gav,
We're looking at error handling in this build as you know. Thanks for the submission.
My only concerns really are that CFERROR seems an unlikely candidate for placing in the getDisplay() function. Wouldn't we be better putting CFERROR in the Application.cfm and CFTHROWing a properly described error from any relevant method?
The primary reason for supressing errors in the presentation layer was for container content gone bad. This could potentially lead to lots of pages being knocked out from a single piece of corrupted data or programming. However, error supression appears to have become a default in other areas where it should not be.
I'd personally prefer to see all errors thrown with the exception of containers. And we're trying to work towards that in the next release.
-- geoff http://www.daemon.com.au/
Gavin Cooney wrote:
Hi All,
Without a debug=1 at the end of the url, errors are suppressed in farcry by default. The user just gets half a page (or worse a blank one!) and the developer may never know.
I've never liked the way this worked so i made some changes. Hopefully it might be useful to some of you, and perhaps make it to the core?
The errors I mean would be as a result of code in your display methods and includes.
The core changes as outlined below behave exactly the same as the current version of farcry core. But if you drop a custom error handler into /farcry/applicationname/tags/errorhandlers/displayMethodError.cfm it will do whatever you want. (see an example handler below).
Any questions, just mail me.
Regards
Gav
To Implement:
-------------------------------------------------------------- Replace the getDisplay function in /farcry_core/packages/types/types.cfc with this: -------------------------------------------------------------- <cffunction name="getDisplay" access="public" output="Yes"> <cfargument name="objectid" required="yes" type="UUID"> <cfargument name="template" required="yes" type="string"> <cfargument name="dsn" required="no" type="string" default="#application.dsn#"> <!--- get the data for this instance ---> <cfset var stObj = getData(objectid=arguments.objectID,dsn=arguments.dsn)> <cfif NOT structIsEmpty(stObj)> <cferror template="/farcry/farcry_core/tags/errorhandlers/displayMethodError.cfm" type="EXCEPTION"> <cferror template="/farcry/farcry_core/tags/errorhandlers/displayMethodError.cfm" type="VALIDATION"> <cferror template="/farcry/farcry_core/tags/errorhandlers/displayMethodError.cfm" type="REQUEST">
<cfinclude template="/farcry/#application.applicationname#/#application.path.handler#/#stObj.typename#/#arguments.template#.cfm">
</cfif> </cffunction> -------------------------------------------------------------- Add this to /farcry_core/tags/errorhandlers/displayMethodError.cfm -------------------------------------------------------------- <cfif NOT fileExists("#application.path.project#/tags/errorhandlers/displayMethodError.cfm")> <cfif isdefined("url.debug")> <cfset request.cfdumpinited = false> <cfoutput> #cferror.generatedContent# #cferror.message#<br /> #cferror.detail# </cfoutput> <cfdump var="#cferror#"> <cfelse> <cfoutput> #cferror.generatedContent# </cfoutput> </cfif> <cfelse> <cfmodule template="/farcry/#application.applicationname#/tags/errorhandlers/displayMethodError.cfm" stError="#cferror#">
</cfif> -------------------------------------------------------------- The in your application folder, you can have your own custom error handler page that does whatever you want it to do.... The following is just an example. /farcry/applicationname/tags/errorhandlers/displayMethodError.cfm Note: remember to add in your own email address to the cfmail below. -------------------------------------------------------------- <cfparam name="attributes.stError" type="struct" />
<cfoutput> #attributes.stError.generatedContent# #attributes.stError.message#<br /> #attributes.stError.detail# </cfoutput>
<cfset request.cfdumpinited = false> <cfsavecontent variable="error_debug"> <p>------------------------------</p> Stobj Vars:<br> <cfdump var="#request.stobj#" /> <p>------------------------------</p> Form Vars:<br> <cfdump var="#form#"> <p>------------------------------</p> URL Vars:<br> <cfdump var="#url#"> <p>------------------------------</p> CGI Vars:<br> <cfdump var="#cgi#"> <p>------------------------------</p> Error Vars:<br> <cfdump var="#attributes.stError#"> <p>------------------------------</p> </cfsavecontent> <cflog application="NO" type="Error" file="farcry_#application.applicationname#_errors" date="YES" time="YES" text="#error_debug#" />
<cfmail to="[EMAIL PROTECTED]" from="[EMAIL PROTECTED]" subject="farcry : #application.applicationname# - #attributes.stError.message#" type="HTML"> #error_debug# </cfmail>
--- You are currently subscribed to farcry-dev as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
