Raise a NoManifestException when the manifest DNE
When a command (eg, `repo forall`) expects the manifest project to
exist, but there is no manifest, an IOException gets raised. This
change defines a new Exception type to be raised in these cases and
raises it when project.py fails to read the manifest.
Change-Id: Iac576c293a37f7d8f60cd4f6aa95b2c97f9e7957
diff --git a/main.py b/main.py
index 9594454..83967f7 100755
--- a/main.py
+++ b/main.py
@@ -42,6 +42,7 @@
from error import DownloadError
from error import ManifestInvalidRevisionError
from error import ManifestParseError
+from error import NoManifestException
from error import NoSuchProjectError
from error import RepoChangedException
from manifest_xml import XmlManifest
@@ -140,6 +141,10 @@
except ManifestInvalidRevisionError as e:
print('error: %s' % str(e), file=sys.stderr)
result = 1
+ except NoManifestException as e:
+ print('error: manifest required for this command -- please run init',
+ file=sys.stderr)
+ result = 1
except NoSuchProjectError as e:
if e.name:
print('error: project %s not found' % e.name, file=sys.stderr)