I am writing a tool that processes some files. This tool will have a command line interface, but can also be used as a library of classes from third-party code. To deal with the error, I just throw an exception. Third-party code can handle the exception, and the command line interface can simply print it and abort. However, in addition to fatal errors, it is also possible that a situation arises that is not fatal, and the process can continue, for which I would like to “throw a warning” and continue.
How can I deal with warnings so that both third-party code and the command line interface can do something with it?
source
share