[ColdBox 5.4] Modules + onInvalidEvent handlers


I have a coldbox application and have written a module to serve as the application api. I have configured the global invalidEventHandler in my coldbox.cfc but I would like to have a different action fire if I am trying to route to the module.

For example,

If i hit http://example.com/nonexistentHandler/index I would like the global invalidEventHandler to fire.
If i hit http://example.com/module/entryPoint/nonexistentHandler/index I would like a different invalidEventHandler to fire

This is because I would always prefer to return json back from my api module and the regular error if using the main application


For that I think you may need to do one of two things. Put in a check in the global error handler to detect what the route is, or register a catch all route for your module that acts as a missing handler error. You’d need to test to see what works best.

Thanks Brad,

I went with your first suggestion