Hello Chris,

Are those "action classes" following a pattern? In other words: do you have some basic repeated structure from whiuch your REST API is made of? If yes, then the "action dispatcher" can be much less complex by using URL path encoded dispatch instead of routing. I had an example doing that for Ensemble (https://community.intersystems.com/post/creating-restful-service-using-ensemble) quite a time ago. It Works for non-Ensemble services too. 

The key is that you have a single dispatch method in your "action dispatcher", which calls the static methods of your "action classes" AND the class name of it somehow derived from a "movable part" of your URL path.


Do not confuse your self. Response is the data being expected as a result of a call. Exception is never expected. An exception is like an asynchronous event trapped by a dedicated error handler.  The trap prepares (or not) to do something to compensate the impact of an error.

Therefor like in COS or Java  you need to define a compensation scope (try block) and compensation handlers (catch block). BPL provides components to do it.