Move error handling into CLI class

Instead of handling errors, exit codes and other stuff like that all over the code, raise an exception and let the class which communicates with the user handle errors.