enhancement: make compilation errors easier to read

2 views
Skip to first unread message

Todd Sharp

unread,
Jan 26, 2010, 3:00:37 PM1/26/10
to javaloader-dev
I sent this to Mark directly but he suggested I post here for
discussion...

Just having a play with the dynamic compilation and came up with a bit
of an enhancement for the JavaCompiler.cfc.

Line 163 (in v1.0 beta 2) - method throwException() - I changed to
this:

<cffunction name="throwException" access="private" hint="Throws an
Exception" output="false">
<cfargument name="type" hint="The type of exception" type="string"
required="Yes">
<cfargument name="message" hint="The message to accompany the
exception" type="string" required="Yes">
<cfargument name="detail" type="string" hint="The detail message
for the exception" required="No" default="">
<cfset var m = "" />
<cfset var d = "" />
<cfsavecontent variable="m"><cfoutput><pre>#arguments.message#</
pre></cfoutput></cfsavecontent>
<cfsavecontent variable="d"><cfoutput><pre>#arguments.detail#</
pre></cfoutput></cfsavecontent>

<cfthrow type="#arguments.type#" message="#m#" detail="#d#">
</cffunction>

It makes the compilation errors much, much easier to read if you wrap
them in the <pre> tag like that (at least when viewing the standard CF
error template).

Here's an example:

Current exception:

http://twitpic.com/zw20e/full

After my enhancement:

http://twitpic.com/zw20p/full

Mark wondered if this is the job of JavaLoader or the exception
handler code in your app... any thoughts on that?

Mark Mandel

unread,
Jan 27, 2010, 3:21:41 PM1/27/10
to javaloa...@googlegroups.com
Dunno if anyone cares except you and me, Todd ;o)

I would say, if you were going to <pre> anything, you would <pre> the details, not the message, and only particular exceptions.

I always worry that error tempaltes will htmlEditFormat() any error messages, so I left it as is, for developers to output errors as they saw fit.

But I do see the need.

Mark
--
E: mark....@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

Hands-on ColdFusion ORM Training @ cf.Objective() 2010
www.ColdFusionOrmTraining.com/

Todd Sharp

unread,
Jan 27, 2010, 4:23:23 PM1/27/10
to javaloa...@googlegroups.com
nod...it's all good - i'll just mod my own version (wait, i already did that... :D)  and - right, only the details need <pre>'ing...

thanks for listening ;)
--
Todd Sharp
Sharp Interactive, LLC
http://slidesix.com -- Multimedia Enabled Presentation Sharing
IM:  cfsi...@gmail.com
Blog:  http://cfsilence.com
Twitter: cfsilence | slidesix

Mark Mandel

unread,
Jan 27, 2010, 11:10:46 PM1/27/10
to javaloa...@googlegroups.com
Tell ya what - put a ticket on the bug tracker, lets possibly revisit it for 1.1

It sounds like a good idea in some circumstances.

Mark
Reply all
Reply to author
Forward
0 new messages