Merge pull request #58 from felixonmars/improve-error

Improve error message for non-exist nvtake targets
This commit is contained in:
依云 2017-08-05 08:38:26 +08:00 committed by GitHub
commit 0912747416
1 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,13 @@ def take():
newvers = core.read_verfile(s.newver) newvers = core.read_verfile(s.newver)
for name in args.names: for name in args.names:
oldvers[name] = newvers[name] try:
oldvers[name] = newvers[name]
except KeyError:
logger.fatal(
"%s doesn't exist in 'newver' set.", name
)
sys.exit(2)
try: try:
os.rename(s.oldver, s.oldver + '~') os.rename(s.oldver, s.oldver + '~')