[coldbox-5.1.4] question about how invalid events work

I have a problem where I am struggling to capture an invalid event. Consider the following routes/handlers:

route( pattern="/product/:product/client/:client/reports/:reportGroup", target="client.reports.reportGroup.index", name="Client Reports" ).end(); route( pattern="/product/:product/client/:client/reports", target="client.reports", name="Client Reports" ).end(); route( pattern="/product/:product/client/:client", target="client.index", name="Client" ).end();

When I access /product/:product/client/:product/reports/ (with client and product values in lieu of placeholders) everything works as expected. If I try to access /product/:product/client/:client/report (“report” doesn’t exist), I fall back to the 3rd route listed, /product/:product/client/:client, which is not the desired behavior. Shouldn’t an invalid event be fired here, since “report” doesn’t exist as a handler, only “reports”?

Actually, that would be the correct cascade of that route, since the pattern in your route was matched to the last item in the chain. Since Coldbox also supports name/value pairs in the URL, it would simply match up to the first route it encounters

You have two choices:

  1. handle the 404 in your /client/:client action
  2. Add strong typing to the :client ( Pattern Placeholders - ColdBox HMVC Documentation ) which will trigger the invalid event if the parameter typing isn’t matched