use Exception instead of BaseException for bare expection

This commit is contained in:
Yuming Zhu 2020-03-02 18:27:24 +08:00
parent b3b0c8d51e
commit cf34706f04
21 changed files with 70 additions and 70 deletions

View file

@ -699,7 +699,7 @@ def stream_logs(server, handler, builds):
try:
fd = open(log, 'r')
logs[log] = (relpath, fd)
except BaseException:
except Exception:
log_local('Error opening %s' % log)
continue
else:
@ -713,7 +713,7 @@ def stream_logs(server, handler, builds):
del contents
try:
server.uploadDirect(relpath, offset, size, digest, data)
except BaseException:
except Exception:
log_local('error uploading %s' % relpath)
time.sleep(1)
@ -729,14 +729,14 @@ def fail(server, handler):
logfd.flush()
upload_file(server, os.path.dirname(logfile),
os.path.basename(logfile))
except BaseException:
except Exception:
log_local('error calling upload_file()')
while True:
try:
# this is the very last thing we do, keep trying as long as we can
server.failTask(tb)
break
except BaseException:
except Exception:
log_local('error calling server.failTask()')
sys.exit(1)
@ -806,7 +806,7 @@ def main():
results['logs'].append(os.path.basename(logfile))
server.closeTask(results)
except BaseException:
except Exception:
fail(server, handler)
sys.exit(0)