Custom throw not caught

46 views
Skip to first unread message

Arc.Net

unread,
Feb 14, 2016, 4:53:21 PM2/14/16
to Lucee
After upgrading from Railo 4.2 to Lucee 4.5.2 the following code does not catch the exception:

<!--- : Returns a fake stacktrace for debugging --->
<cffunction name="getStackTrace" output="true" returntype="array">
   
    <cfscript>
    try {
        throw type="Application";
    } catch (Application e) {
        return e.StackTrace;
    }
    </cfscript>
</cffunction>

I've also tried using "Any e".

Instead the exception is caught up the chain and reported as an "Application" error. Why is my try/catch statement being completely ignored by Lucee 4.5.2 ?

Shannon


Hugo Ahlenius

unread,
Feb 16, 2016, 3:55:52 AM2/16/16
to lu...@googlegroups.com
Arc.Net wrote on 2016-02-14:
> After upgrading from Railo 4.2 to Lucee 4.5.2 the following code does
> not catch the exception:

Oh, that is so easy to test and fix - did you isolate this to a separate template without any application logic? Try returntype "any" or enclosing return [e.StackTrace] (note the brackets) - then it works!

AJ Mercer

unread,
Feb 16, 2016, 7:57:32 PM2/16/16
to lu...@googlegroups.com

--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
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/0c9d01d16897%247e4470e0%247acd52a0%24%40oxel.net.
For more options, visit https://groups.google.com/d/optout.



--

Andrew Dixon

unread,
Feb 17, 2016, 3:28:17 AM2/17/16
to lu...@googlegroups.com
Or if you want the return type to be array, to enforce your normal return as array then you can do:

return [e.StackTrace];

In the catch to make the stacktrace be inside an array.

Kind regards,

Andrew

Reply all
Reply to author
Forward
0 new messages