Error variable structure

106 views
Skip to first unread message

Pierre Larde

unread,
Nov 27, 2016, 2:25:25 PM11/27/16
to Lucee
In Coldfusion, I was using the error structure to get error informations,
like : #error.template# ,  #error.rootCause# , #error.diagnostics# , etc ...

with Lucee 4.5 , these variables give an error

In what variable to get error informations ?

Thanks for help

Igal @ Lucee.org

unread,
Nov 27, 2016, 4:00:31 PM11/27/16
to lu...@googlegroups.com

Why not do something like:

    <cfdump var="#error#">

or

    dump(error)

and find out all of the information available in the error struct?

alternatively, StructKeyList(error) and StructKeyArray(error) should give you the keys only.

Igal Sapir
Lucee Core Developer
Lucee.org

--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/061102ef-99fd-4f69-936f-9269fe70369c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pierre Larde

unread,
Nov 28, 2016, 6:05:38 AM11/28/16
to Lucee
I tried cfdump of error
And, message is : variable "error" doest not exists.

So, what is the way to get error informations ?

I used this Under coldfusion to get error information.
Thanks,
Pierre.

Julian Halliwell

unread,
Nov 28, 2016, 7:56:05 AM11/28/16
to lu...@googlegroups.com
To handle errors globally try using the onError() method in your application.cfc

Dumping the exception object will tell you what information is available.

void function onError( exception ){
dump( exception );

Pierre Larde

unread,
Nov 28, 2016, 8:26:48 AM11/28/16
to Lucee
I do not understand well,
Do you have a full code example ?

I use the old fashion application.cfm
But I think there is no difference.
What code line to put in the application.cfm

Today I have :
<cferror type = "exception" template = "site_error.cfm">

and in site_error.cfm
I was using the error structure variables. (via a mail to support)

Could you give me a full replacement of this code (from Coldfusion, working fine)

Thanks a lot.
Pierre.


Le dimanche 27 novembre 2016 20:25:25 UTC+1, Pierre Larde a écrit :

Julian Halliwell

unread,
Nov 28, 2016, 9:08:52 AM11/28/16
to lu...@googlegroups.com
You need to use application.cfc not application.cfm to use the onError() method.

However, I've just tested using the <cferror> tag in an
application.cfm file and it produced the "error" struct as expected.
i.e. I created 3 files in the same folder:

application.cfm
<cferror template="error.cfm" type="exception">

error.cfm
<cfdump var="#error#">

test.cfm
<cfset x><!--- trigger an error --->

Try replicating this simple test to see if it works for you. If so,
then try and identify what's different about the code where it's not
working.

Julian.

Pierre Larde

unread,
Nov 28, 2016, 11:07:47 AM11/28/16
to Lucee
OK, yes, it does all work again.
I am confused.

Thanks.




Le dimanche 27 novembre 2016 20:25:25 UTC+1, Pierre Larde a écrit :
Reply all
Reply to author
Forward
0 new messages