Adding try catch for CLI type of apps.