Query ignores error after successful statement and losses the nested error in multiple queries

Description

I’ve only tested this so far with MS SQL, but Adobe differs here and Lucee behavior is misleading. If a query has more than one statement, and the first statement (whether a select or an update, etc) is successful, but a later statement raises an exception, Adobe will throw the exception, but Lucee will completely ignore it as though it never happened.

These two examples work on MS SQL Server:

or this one

In both cases, Adobe CF will throw the error. Lucee will totally ignore it and you’ll think your code is running fine!

It doesn’t have to be a raiseError() statement. I fist noticed this with a normal INSERT query that was blowing up due to a type issue but I couldn’t figure out why it wasn’t running. It was something like this

The insert was blowing up, but we had no idea because the update on top of it was successful and that’s what Lucee was looking at. My assumption is that the JDBC result is sending back information about each of the statements in the batch and Lucee needs to be looking at all of them, not just the first one to check for any exceptions.

Furthermore, if I run this code in Adobe

Then Adobe reports ALL of the exceptions as nested errors. The outermost one is the first to be thrown (boom1) and the inner most exception is “boom3”.

Attachments

1

Activity

Pothys - MitrahSoft 
16 August 2022 at 13:54

Lucee losses the nested error with multiple queries in MSSQL. Seems ACF includes the nested error in the catch block cause key.

I added the testcase to this ticket
Pull Request:

Brad Wood 
12 August 2022 at 14:26

Thank you!

Pothys - MitrahSoft 
12 August 2022 at 14:20

Ok I will make a testcase for the nested exception issue too

Brad Wood 
12 August 2022 at 14:00

Wow, I searched and searched the bug tracker and couldn’t find any existing tickets before I created this one! I can’t believe how hard they were to find. I’d rather my ticket not be closed as I included unique details which are not present in the other ticket-- specifically the behavior Adobe CF follows when more then one exception are raised with the nested exception. If we close this ticket, that will never be implemented or tested.

Pothys - MitrahSoft 
12 August 2022 at 06:37

There is already a ticket for this issue and the issue was solved in lucee version 5.3.8.169-SNAPSHOT. But the changes were reverted in 5.3.8.186-SNAPSHOT due to some issues with other drivers.

Using any one of the below options you can use the changes done in LDEV-3127. Could you please check with this and report here back?

Shall I close the ticket as a duplicate?

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Priority

Created 11 August 2022 at 18:53
Updated 20 September 2024 at 20:28