Differences with exceptions

I’m doing a try/catch around some code that inserts to the db. The catch
looks like

catch(Any e) {
if ( e.NativeErrorCode EQ “2601”) //Cannot insert duplicate key row

{
// do something
} else {
rethrow;
}
}

This works in ACF but fails in Lucee 5. When I dump the exception I see
they are quite different.

http://www.screencast.com/t/eQObJKJcEE

Is that a bug?

Thanks,
Phil

Armchair opinion here, but I would not expect the exceptions in ACF and
Lucee to be at all the same, because there would not be a specification or
documentation of any kind that would indicate to the different development
teams what messages each individual exception should return. You could file
an enhancement request to make the exceptions the same, but I find that
completely unrealistic.

You could also file an enhancement request to make this specific exception
the same, at least the NativeErrorCode bit. I have no idea how useful that
might be to others.

Aria Media Sagl
+41 (0)76 303 4477 cell
skype: ariamediaOn Tue, Aug 30, 2016 at 6:10 PM, Phil Cruz <@Phil_Cruz> wrote:

I’m doing a try/catch around some code that inserts to the db. The catch
looks like

catch(Any e) {
if ( e.NativeErrorCode EQ “2601”) //Cannot insert duplicate key row

{
// do something
} else {
rethrow;
}
}

This works in ACF but fails in Lucee 5. When I dump the exception I see
they are quite different.

http://www.screencast.com/t/eQObJKJcEE

Is that a bug?

Thanks,
Phil


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+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/ff864e80-9763-4e1d-91a2-12c0d89c348e%40googlegroups.com
https://groups.google.com/d/msgid/lucee/ff864e80-9763-4e1d-91a2-12c0d89c348e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

What is the “type” on the lucee exception? It is not visible from the
screenshot.On Tuesday, August 30, 2016 at 11:10:46 AM UTC-5, Phil Cruz wrote:

I’m doing a try/catch around some code that inserts to the db. The catch
looks like

catch(Any e) {
if ( e.NativeErrorCode EQ “2601”) //Cannot insert duplicate key row

{
// do something
} else {
rethrow;
}
}

This works in ACF but fails in Lucee 5. When I dump the exception I see
they are quite different.

http://www.screencast.com/t/eQObJKJcEE

Is that a bug?

Thanks,
Phil

It’s “application”

http://www.screencast.com/t/HnQaQGCbm

-PhilOn Wednesday, August 31, 2016 at 8:33:55 AM UTC-7, Jesse Shaffer wrote:

What is the “type” on the lucee exception? It is not visible from the
screenshot.

On Tuesday, August 30, 2016 at 11:10:46 AM UTC-5, Phil Cruz wrote:

I’m doing a try/catch around some code that inserts to the db. The catch
looks like

catch(Any e) {
if ( e.NativeErrorCode EQ “2601”) //Cannot insert duplicate key row

{
// do something
} else {
rethrow;
}
}

This works in ACF but fails in Lucee 5. When I dump the exception I see
they are quite different.

http://www.screencast.com/t/eQObJKJcEE

Is that a bug?

Thanks,
Phil

It also looks like you’re using ORM. ACF appears to be passing through the
JDBC exception, while Lucee is wrapping it in an Application exception.
Just as an experiment - can you try this on Lucee:

writedump(e.getCause());
writedump(e.getSuppressed());On Wednesday, August 31, 2016 at 10:35:31 AM UTC-5, Phil Cruz wrote:

It’s “application”

http://www.screencast.com/t/HnQaQGCbm

-Phil

On Wednesday, August 31, 2016 at 8:33:55 AM UTC-7, Jesse Shaffer wrote:

What is the “type” on the lucee exception? It is not visible from the
screenshot.

On Tuesday, August 30, 2016 at 11:10:46 AM UTC-5, Phil Cruz wrote:

I’m doing a try/catch around some code that inserts to the db. The catch
looks like

catch(Any e) {
if ( e.NativeErrorCode EQ “2601”) //Cannot insert duplicate key row

{
// do something
} else {
rethrow;
}
}

This works in ACF but fails in Lucee 5. When I dump the exception I see
they are quite different.

http://www.screencast.com/t/eQObJKJcEE

Is that a bug?

Thanks,
Phil

Yes, I am using ORM. Here is a stripped down test case

try { activationCode = "B5FB4CACC332D842EF99BB06CE1DAA35"; machineID = "TESTMACHINE1"; act = EntityNew("Activation"); sn = EntityLoadByPK("SerialNumber", 196941); act.setMachineID(machineID); act.setActivationCode(activationCode); act.setDateCreated(now()); act.setActivationStatusID(1); act.setLastName(""); act.setEmail(""); act.setSerialNumber(sn); act.save(); } catch (Any e) { writeDump(StructKeyList(e)); //on ACF: "Suppressed,RootCause,StackTrace,Detail,Message,Cause,Type,TagContext" //on Lucee: "Extended_Info,Message,Detail,additional,TagContext,ErrorCode,type,StackTrace,ExtendedInfo" //writeDump(var=e, format="html"); writeDump(var=e.getCause(), label="getCause"); writeDump(var=e.getSuppressed(), label="getSuppressed"); }

That runs fine on ACF. On Lucee 5 it errors on e.getCause() with “No
matching Method/Function for Struct.getCause() found” and similar error for
getSuppressed.

Thanks,
PhilOn Wednesday, August 31, 2016 at 8:45:29 AM UTC-7, Jesse Shaffer wrote:

It also looks like you’re using ORM. ACF appears to be passing through
the JDBC exception, while Lucee is wrapping it in an Application exception.
Just as an experiment - can you try this on Lucee:

writedump(e.getCause());
writedump(e.getSuppressed());

On Wednesday, August 31, 2016 at 10:35:31 AM UTC-5, Phil Cruz wrote:

It’s “application”

http://www.screencast.com/t/HnQaQGCbm

-Phil

On Wednesday, August 31, 2016 at 8:33:55 AM UTC-7, Jesse Shaffer wrote:

What is the “type” on the lucee exception? It is not visible from the
screenshot.

On Tuesday, August 30, 2016 at 11:10:46 AM UTC-5, Phil Cruz wrote:

I’m doing a try/catch around some code that inserts to the db. The
catch looks like

catch(Any e) {
if ( e.NativeErrorCode EQ “2601”) //Cannot insert duplicate key row

{
// do something
} else {
rethrow;
}
}

This works in ACF but fails in Lucee 5. When I dump the exception I see
they are quite different.

http://www.screencast.com/t/eQObJKJcEE

Is that a bug?

Thanks,
Phil