Hi @lmajano,
I’ve prepared a package for you that you can run.
You can download from here:
http://www.coridalia.cc/tmp/cb-bug-exception.zip
Ok, let’s start, on CommandBox. Unzip file in a directory and:
install
server start
then, open your browser here:
http://localhost:8198/apps/api/
-
CB invokes Util.index, and before it invokes “preProcess” in MainInterceptor.
-
MainInterceptor contains an Error, searches for a key that not exists:
GetHTTPRequestData().headers['NOT_EXISTS']
File in apps\api\interceptor\MainInterceptor.cfc
-
ColdBox invokes util.onError, as configuration. The corrected error message is shown.
-
Now we reproduce the error:
a) Comment/remove util.onError method in apps\api\controller\AbsController.cfc
b) Now, without util.onError, CB invokes “onError” in RestHandler, where arguments.exception is empty (ad default, not null).
The exception obj is in arguments.prc.exception.getExceptionStruct()
, but the line 171 in RestHandler is never run because arguments.exception
is empty (default={}), not null.
170: if ( isNull( arguments.exception ) && !isNull( arguments.prc.exception ) ) {
171: arguments.exception = arguments.prc.exception.getExceptionStruct();
172: }
c) Now, Lucee raises an error, because, in line 181, the key “message” in arguments.exception not exists:
181: Error in base handler (#arguments.faultAction#): #arguments.exception.message#",
d) at the end, CB invokes “onAnyOtherException” (in my AbsController) and i can view the error in RestHandler. This:
key [MESSAGE] doesn't exist
179: // Log Locally
180: log.error(
181: "Error in base handler (#arguments.faultAction#): #arguments.exception.message# #arguments.exception.detail#",
182: {
183: "_stacktrace" : arguments.exception.stacktrace,
system.resthandler_cfc$cf.udfCall1(/coldbox/system/RestHandler.cfc:181)
In my opinion, it would be enough to edit line 70 of RestHandler.cfc:
IsNull( arguments.exception )
to
StructIsEmpty( arguments.exception )
I hope it is useful for you.
If you need, do not hesitate to write me.
Thanks for your attention.