Catching an error message

92 views Asked by At

I'm using Coldfusion Fusebox 3 and I would like to know how I can keep my app from throwing an error message if someone thoughtlessly removes the Circuit and fuseaction from the URL. For example, if the original URL is:

http://www.noname/Intranet/index.cfm?fuseaction=Bulletins.main ...and someone removes the circuit information so it reads like the following: http://www.noname/Intranet/index.cfm?fuseaction= ...the app throws an error message. Can I code against something like this happening?

Here is my fbx_Settings.cfm file as it exists right now. Thank you.

1

There are 1 answers

0
user2029952 On

Try something along these lines, haven't had chance to test but should go something like this in your index.cfm file.

<cfprocessingdirective suppressWhiteSpace="yes">
  <cftry>
   <!--- Include the config file --->
   <cfinclude template="../config.cfm">
   <cfset variables.fromFusebox = True>
   <cfinclude template="fbx_fusebox30_CF50.cfm">

   <cfif Len(fusebox.fuseaction) EQ 0>
    <!--- Error Handle --->
   </cfif> 

  <cfcatch type="Any">  
    <!---<cfset SendErrorEmail("Error", cfcatch)><cfabort />--->
  </cfcatch>
 </cftry>
</cfprocessingdirective>

or better still, in your switch file have a default case such as:

<cfdefaultcase>
    <cfinclude template="act_HandleError.cfm">
    <cflocation url="hompage.cfm" addtoken="false">
</cfdefaultcase>

Hope this helps!