That solution seems reasonable for what you're trying to do, although it can be simplified. CLI::Framework::Application uses the handle_exception method as a simple way for you to define an error-handling policy. Exceptions are passed to that method, where they can be handled however you wish. I think your needs will be met by overriding handle_exception to exit with the proper code based on the type of exception.
Note that, with either of these approaches, the exit() will cause interactive mode to exit abruptly during error conditions. That may be fine in your case. However, to avoid having that happen, your implementation of handle_exception() could check whether the application is in interactive mode using get_interactivity_mode and exit only when it is not interactive.