|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
debugging in cfscript
hi,Richard White 05/20/08 01:17 P Depending on where you are in the script it could be as simple as ending theAaron Rouse 05/20/08 01:20 P <cffunction name="cf_abort" output="false" returntype="void">Charlie Griefer 05/20/08 01:21 P I added this to my component, but I'm getting an error while calling it from within the component.daniel kessler 02/08/12 02:16 P To clarify, I receive an error when these function calls are used and no error when they're commented out.daniel kessler 02/08/12 02:24 P First off, this is a nearly 4 year old thread. It may or may not apply toMatt Quackenbush 02/08/12 02:29 P >First off, this is a nearly 4 year old thread. It may or may not apply todaniel kessler 02/08/12 02:38 P The error code mentions Line 63 as the start of an if () statement, andMatt Quackenbush 02/08/12 02:44 P > when debugging with coldfusion tags i use the cfoutput and cfdump tags alot but how can i use these tags and the cfabort tag within cfscript, or how can i get the > same effect as these tags? A common practice is to create a udf that wraps the functionality of a cf tag, so:Dominic Watson 05/20/08 01:25 P thanks guys, very neat solution :)Richard White 05/20/08 01:33 P hi, when debugging with coldfusion tags i use the cfoutput and cfdump tags alot but how can i use these tags and the cfabort tag within cfscript, or how can i get the same effect as these tags? thanks richard Depending on where you are in the script it could be as simple as ending the cfscript then putting in a cfdump and then beginning the cfscript again. I often debug small problems within cfscripts by using writeoutput functions for the values on if statements and other things of that nature. I suppose you could create a function that simple dumps out whatever you fed it so that you could put inline dumps. ----- Excess quoted text cut - see Original Post for more ----- <cffunction name="cf_abort" output="false" returntype="void"> <cfabort /> </cffunction> <cffunction name="cf_dump" output="false" returntype="void"> <cfargument name="objToDump" type="any" required="false" default="" /> <cfdump var="#arguments.objToDump#" /> </cffunction> <cfscript> var myArray = newArray(1); myArray[1] = "Larry"; myArray[2] = "Moe"; myArray[3] = "Curly"; cf_dump(myArray); cf_abort; </cfscript> ----- Excess quoted text cut - see Original Post for more ----- I added this to my component, but I'm getting an error while calling it from within the component. <cfcomponent hint="Replaces The Package PK_employer"> <cffunction name="cf_abort" output="false" returntype="void"> <cfabort /> </cffunction> <cffunction name="cf_dump" output="false" returntype="void"> <cfargument name="objToDump" type="any" required="false" default="" /> <cfdump var="#arguments.objToDump#" /> </cffunction> Then further down, I call the cf_dump, like cf_dump(dbResult); How do I implement this correctly? Thank you for your assistance. To clarify, I receive an error when these function calls are used and no error when they're commented out. ----------- Invalid CFML construct found on line 78 at column 33. ColdFusion was looking at the following text: else The CFML compiler was processing: a script statement beginning with "{" on line 63, column 39. a script statement beginning with "if" on line 63, column 17. a cfscript tag beginning on line 52, column 18. a cfscript tag beginning on line 52, column 18. The error occurred in C:\localServer\beatch\cfc\emp.cfc: line 78 76 : //cf_dump(dbResult); 77 : cf_abort; 78 : else 79 : request.inStruct.beatch_id = ""; 80 : First off, this is a nearly 4 year old thread. It may or may not apply to what you're working on now. What CFML engine and version are you using? What is the relevant code? ----- Excess quoted text cut - see Original Post for more ----- >First off, this is a nearly 4 year old thread. It may or may not apply to >what you're working on now. > >What CFML engine and version are you using? > >What is the relevant code? I didn't think reposting was a good idea, since there was a thread with a relevant history. I'm using CF7. I posted the relevant code: part of the component, the cfabort/dump code, and my call. Is there more code that you would like? The error code mentions Line 63 as the start of an if () statement, and Line 52 as the start of the <cfscript> tag. We'll need probably the entire if () block at the least, as it would seem the issue lies in there. Hard to speculate based solely upon the error message, as CF is notorious for providing rather cryptic error messages which often send one off chasing ghosts. ----- Excess quoted text cut - see Original Post for more ----- > when debugging with coldfusion tags i use the cfoutput and cfdump tags alot but how can i use these tags and the cfabort tag within cfscript, or how can i get the > same effect as these tags? A common practice is to create a udf that wraps the functionality of a cf tag, so: <cffunction name="dump"> <cfargument name="var" type="any" required="true"> <cfargument name="expand" type="boolean" required="false" default="true"> <cfargument name="label" type="string" required="false" default=""> <cfdump var="#arguments.var#" expand="#arguments.expand#" label="#arguments.label#"> </cffunction> <cfscript> aArray = ArrayNew(1); aArray[3] = 'fooey'; dump(aArray); </cfscript> Dominic -- Blog it up: http://fusion.dominicwatson.co.uk thanks guys, very neat solution :)
|
February 08, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||