invalidEvent not in rc for onInvalidEvent event handler?

I'm on ColdBox 3.0.0 Beta 3 and have the following setting in my
ColdBox XML file:

    <Setting name="onInvalidEvent" value="Sorry.pageNotFound"/>

In Sorry.pageNotFound(), I expected to be able to access the invalid
event key but it's missing:

  public void function pageNotFound( any event ) {

    var rc = event.getCollection();

    createObject( 'java', 'java.lang.System' ).out.println( 'I handled
an invalid event!' );
    // rc.invalidevent ought to be present but doesn't seem to be...
    createObject( 'java', 'java.lang.System' ).out.println( 'Event: ' &
rc.invalidEvent );


It looks like HandlerService.cfc should put the runnable event name
into that event key in one place but not in a later place:

lines 133-137:
          //Place invalid event in request context.

          // Relocate to Invalid Event, with collection persistance

lines 249-259:
    // If onInvalidEvent is registered, use it
    if ( len(trim(onInvalidEvent)) ){
      // Test for invalid Event Error
      if ( compareNoCase(onInvalidEvent,event) eq 0 ){
        getUtil().throwit(message="The onInvalid event is also invalid",
                  detail="The onInvalidEvent setting is also invalid:
#onInvalidEvent#. Please check your settings",
      // Relocate to Invalid Event

Is there a reason for this difference or is it just a bug?


Hi Sean

The differences are that the onInvalidEvent should not redirect, this was like that in 2.6.3, but updated in 3.0.0 B2, in order to test some other stuff. The right behavior is that it does NOT relocate, it masks the incoming event and displays the invalid event as the main event.

This is my last ticket for Milestone 4.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:

Ah, cool, because the other issue I ran into is that when you have an
onInvalidEvent handler, you get a 302 for an invalid event where you
really want a 404 (or at least the option to return 404). Glad to hear
that will get fixed. Thank you.