Custom throw not caught

After upgrading from Railo 4.2 to Lucee 4.5.2 the following code does not
catch the exception:

<cfscript>
try {
    throw type="Application";
} catch (Application e) {
    return e.StackTrace;
}
</cfscript>

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

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!> <!— : Returns a fake stacktrace for debugging —>

<cfscript>
try {
    throw type="Application"; } catch (Application e) { return
    e.StackTrace;
}
</cfscript>

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

yep - return type any fixes it
TryCF.com 16 February 2016 at 16:53, Hugo Ahlenius <@Hugo_Ahlenius> wrote:

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!

<cfscript>
try {
    throw type="Application"; } catch (Application e) { return
    e.StackTrace;
}
</cfscript>

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


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+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@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.

AJ Mercer
<webonix:net strength=“Industrial” /> http://webonix.net | <webonix:org
community=“Open” /> http://webonix.org
http://twitter.com/webonix

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
about.me http://about.me/andrew_dixon - mso http://www.mso.net - Lucee
Association Member http://lucee.orgOn 17 February 2016 at 00:57, AJ Mercer <@AJ_Mercer> wrote:

yep - return type any fixes it
TryCF.com

On 16 February 2016 at 16:53, Hugo Ahlenius <@Hugo_Ahlenius> wrote:

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!

<cfscript>
try {
    throw type="Application"; } catch (Application e) { return
    e.StackTrace;
}
</cfscript>

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


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+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@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.

AJ Mercer
<webonix:net strength=“Industrial” /> http://webonix.net | <webonix:org
community=“Open” /> http://webonix.org
http://twitter.com/webonix


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+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAPURtC2%2BDVpz%2BV7myGokQCR8azOzuZ3W4Nd5JMmGFY-Po9Pdww%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAPURtC2%2BDVpz%2BV7myGokQCR8azOzuZ3W4Nd5JMmGFY-Po9Pdww%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.