This is my first bug submission so please bear with me.
This issue only appears to occur when running Adobe ColdFusion (ACF) servers.
Here's how to replicate the error:
1. Create a new Coldbox App by typing coldbox create app in Commandbox. You can use Coldbox 5 or 6 as they both produce the same issue.
2. Open the handlers\Main.cfc file and add an onError() method that throws the original exception. Here's a simple example:
3. Start the server (remember it must be an ACF server)
4. Run the default tests (/tests/runner.cfm)
You will see that the "can do relocation" test will fail with the following: (see attached screenshot)
coldfusion.runtime.CustomException: Relocating via relocate
I've given some thought to the problem and it appears to be a result of the way ACF handles nested exceptions as opposed to Lucee.
Currently in /coldbox/system/web/Controller.cfc on line 973, Coldbox looks for an onError() method in the handler. If that method exists, it attempts to execute it. Most people probably use the `onError()` method in their handler to do exception handling for custom exception types. If the exception.type isn't what was expected, they probably want the error handler to re-throw the error, like this:
The above code works in Lucee, but not in ACF.
If this turns out to be a limitation of the ACF engine, perhaps a way to work around it would be to tweak the convention and specify that if an `onError()` method returns "false" then Controller.cfc can rethrow the error from the original try/catch block.
Here's what I mean:
Proposed change in coldbox\system\web\Controller.cfc line 971
The above workaround would also mean that my example onError() method would need to be changed as follows:
Hopefully, the information I provided helps! Let me know if you need additional details.
The issue is that Adobe is not smart enough to detect the exception object and lucee does. So the issue is that we must be explicit with Adobe:
You must tag the `exception` as the `object` argument.
By the way thanks for the detailed bug report. I was able to reproduce in 3 minutes. Not many bug reports come with detailed instrcutions
You’re welcome and thank you for the tip on using: