ExceptionBean is undefined in the request collection (private=false)

172 views
Skip to first unread message

Mahmut CIFCI

unread,
Sep 29, 2011, 1:00:23 AM9/29/11
to col...@googlegroups.com
Hi

I want to create my custom Exception Handler. I created the following way;

<cffunction name="onException" access="public" returntype="void" output="false">
<cfargument name="event" type="any" />
<cfscript>
//Grab Exception From request collection, placed by ColdBox
var exceptionBean = event.getValue("ExceptionBean");
//Place exception handler below:
switch ( exceptionBean.getType() ){
    case "Framework.plugins.settings.EventHandlerNotRegisteredException":
      getPlugin("messagebox").setMessage("warning","Aradığınız sayfa bulunamadı.");
      setNextEvent();
      break;
    default:
      //Manually log the errors using the logger plugin.
      getPlugin("logger").logErrorWithBean(ExceptionBean);
     
  }
  //What else, in this case, nothing, the framework will show the exception templa
</cfscript>
</cffunction>

But not working, I get the following errors;

Application Execution Exception

Error Type: RequestContext.ValueNotFound : [N/A]
Error Messages: The variable: ExceptionBean is undefined in the request collection (private=false)
Keys Found: NEWS,REASON1,REASON2,REASON3,event,fwreinit,BANNERS,REASON5,REASON4,lang,TITLE
Tag Context:
ID:CFTHROW
LINE:776
Template:C:\inetpub\wwwroot\coldbox_standalone_3.1.0\system\web\context\RequestContext.cfc
ID:CF_UDFMETHOD
LINE:137
Template:C:\inetpub\wwwroot\coldbox_standalone_3.1.0\system\web\context\RequestContext.cfc
ID:CF_TEMPLATEPROXY
LINE:1
Template:C:\inetpub\wwwroot\odammobilya\views\home.cfm
ID:CFINCLUDE
LINE:271
Template:C:\inetpub\wwwroot\coldbox_standalone_3.1.0\system\plugins\Renderer.cfc
ID:CF_UDFMETHOD
LINE:159
Template:C:\inetpub\wwwroot\coldbox_standalone_3.1.0\system\plugins\Renderer.cfc
ID:CF_UDFMETHOD
LINE:85
Template:C:\inetpub\wwwroot\odammobilya\layouts\Layout.Main.cfm
ID:CFINCLUDE
LINE:384
Template:C:\inetpub\wwwroot\coldbox_standalone_3.1.0\system\plugins\Renderer.cfc
ID:CF_TEMPLATEPROXY
LINE:261
Template:C:\inetpub\wwwroot\coldbox_standalone_3.1.0\system\Coldbox.cfc
ID:CF_UDFMETHOD
LINE:52
Template:C:\inetpub\wwwroot\odammobilya\Application.cfc

Please help me.

Brad Wood

unread,
Sep 29, 2011, 9:02:04 AM9/29/11
to col...@googlegroups.com
Are you trying to run that event directly?  The framework has to call it for you.  Is it set up in the config?
 
~Brad
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org

Mahmut CIFCI

unread,
Sep 29, 2011, 9:06:48 AM9/29/11
to col...@googlegroups.com
What do I need a setting in the config file ?

Mahmut CIFCI

unread,
Sep 29, 2011, 9:08:46 AM9/29/11
to col...@googlegroups.com
When I run the following code also get the same error;

<cfdump var="#event.getValue("ExceptionBean")#" abort="true" />

br...@bradwood.com

unread,
Sep 29, 2011, 11:55:00 AM9/29/11
to col...@googlegroups.com
My exception handler is "ehMain.onException".  As such, I have the following line in my config file:

exceptionHandler = "ehMain.onException",

You are not supposed to call the exception handler directly.  For instance, if you are typing the following in your web browser:
then you're doing it wrong.  That will surely error because there is no exception bean in the request collection.

If you want to test your exception handler, then you need to purposely create an error in another, real handler and ColdBox will automatically call the exception handler for you and it will pass in the exception bean.

Does that make sense?

Thanks!

~Brad

-------- Original Message --------
Subject: Re: [coldbox:11959] ExceptionBean is undefined in the request
collection (private=false)

Mahmut CIFCI

unread,
Sep 30, 2011, 3:50:10 AM9/30/11
to col...@googlegroups.com
I understand you very well, I also like my config file;
exceptionHandler = "Main.onException"

and development

coldbox.exceptionHandler = "Main.onException";

but the application still does not work when I create also a exception, I do not like that directly to the visit http://localhost/Main/onException.

Thanks.

Mahmut.

Lalit Kishor

unread,
May 6, 2016, 7:46:00 AM5/6/16
to ColdBox Platform, mahmutcif...@gmail.com
Hi,
Check you rc by writedump(rc);writedump(prc); and find out ExceptionBean. This error normally occur because ExceptionBean is not available neither rc nor prc. 
It is actually present as exception in prc. 

So right code should be prc.exception.getMessage() and you can use other function of prc.exception....

Thanks
Lalit
Reply all
Reply to author
Forward
Message has been deleted
0 new messages