Refactor: move ensure_app_running inside the big catch block, then we don't need to duplicate error handling.
Nicer formatting of error message.