I have a class that reads configuration. Now the problem is that I don’t know how to report errors from this class.
Using die isn’t sufficient, since the configuration is parametric, and errors are common.
The situation is complicated by the fact, that I’m invoking the read function in Moose BUILD method. Because this usage significantly improves readability when the class is used, I would like to keep it this way.
What is wrong with
die? It throws an exception that you can capture and process as needed. In fact Moose itself throws exception on validation errors.