More verbose errors for NoManifestExceptions.
The old "manifest required for this command -- please run
init" is replaced by a more helpful message that lists the
command repo was trying to execute (with arguments) as well
as the str() of the NoManifestException. For example:
> error: in `sync`: [Errno 2] No such file or directory:
> 'path/to/.repo/manifests/.git/HEAD'
> error: manifest missing or unreadable -- please run init
Other failure points in basic command parsing and dispatch
are more clearly explained in the same fashion.
Change-Id: I6212e5c648bc5d57e27145d55a5391ca565e4149
diff --git a/error.py b/error.py
index 7e52b01..ff948f9 100644
--- a/error.py
+++ b/error.py
@@ -24,6 +24,13 @@
class NoManifestException(Exception):
"""The required manifest does not exist.
"""
+ def __init__(self, path, reason):
+ super(NoManifestException, self).__init__()
+ self.path = path
+ self.reason = reason
+
+ def __str__(self):
+ return self.reason
class EditorError(Exception):
"""Unspecified error from the user's text editor.