Avoid AttributeError when raising raw GitReviewExceptions
Previously, if a GitReviewException was raised (not, for example, a BranchTrackingMismatch or GitDirectoriesException which subclasses it, but an actual GitReviewException), it would still get handled in main(), but it wouldn't have an EXIT_CODE attribute. This happens, for example, in add_remote(), if test_remote_url() fails both times. Now, if the caught exception doesn't have an EXIT_CODE, it will default to -1. Change-Id: I8529b320795717ef8d19ca87d3fa6bd523ef93ae
This commit is contained in:
parent
cfb726e4a0
commit
26e2f72b26
@ -1570,7 +1570,7 @@ def main():
|
||||
print(e)
|
||||
else:
|
||||
print(u.encode('utf-8'))
|
||||
sys.exit(e.EXIT_CODE)
|
||||
sys.exit(getattr(e, 'EXIT_CODE', -1))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user