Catch connection errors
This commit is contained in:
parent
2f653b31ac
commit
182d36a3fc
|
@ -102,8 +102,8 @@ def receive(host, destination):
|
|||
fullpath = os.path.join(destination, filepath[1:])
|
||||
os.makedirs(fullpath, exist_ok=True)
|
||||
with open(os.path.join(fullpath, filename), 'wb') as fd:
|
||||
# TODO split filesize in chunks with remainder
|
||||
fd.write(response.raw.read(int(filesize)))
|
||||
bar.update(len(filelist))
|
||||
|
||||
|
||||
@cli.command()
|
||||
|
@ -153,4 +153,7 @@ def tui():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli()
|
||||
try:
|
||||
cli()
|
||||
except requests.exceptions.ConnectionError as conerr:
|
||||
print(f'Failed to connect. Target alive?')
|
||||
|
|
Loading…
Reference in New Issue