diff options
-rw-r--r-- | editor.py | 11 | ||||
-rw-r--r-- | error.py | 5 |
2 files changed, 14 insertions, 2 deletions
@@ -76,8 +76,15 @@ least one of these before using this command.""" | |||
76 | os.close(fd) | 76 | os.close(fd) |
77 | fd = None | 77 | fd = None |
78 | 78 | ||
79 | if subprocess.Popen(editor + [path]).wait() != 0: | 79 | try: |
80 | raise EditorError() | 80 | rc = subprocess.Popen(editor + [path]).wait() |
81 | except OSError, e: | ||
82 | raise EditorError('editor failed, %s: %s %s' | ||
83 | % (str(e), cls._GetEditor(), path)) | ||
84 | if rc != 0: | ||
85 | raise EditorError('editor failed with exit status %d: %s %s' | ||
86 | % (rc, cls._GetEditor(), path)) | ||
87 | |||
81 | fd2 = open(path) | 88 | fd2 = open(path) |
82 | try: | 89 | try: |
83 | return fd2.read() | 90 | return fd2.read() |
@@ -24,6 +24,11 @@ class ManifestInvalidRevisionError(Exception): | |||
24 | class EditorError(Exception): | 24 | class EditorError(Exception): |
25 | """Unspecified error from the user's text editor. | 25 | """Unspecified error from the user's text editor. |
26 | """ | 26 | """ |
27 | def __init__(self, reason): | ||
28 | self.reason = reason | ||
29 | |||
30 | def __str__(self): | ||
31 | return self.reason | ||
27 | 32 | ||
28 | class GitError(Exception): | 33 | class GitError(Exception): |
29 | """Unspecified internal error from git. | 34 | """Unspecified internal error from git. |