diff --git a/backupbot.py b/backupbot.py index 96c93c6..83e8991 100755 --- a/backupbot.py +++ b/backupbot.py @@ -201,7 +201,18 @@ def list_files(snapshot, path): cmd.append(snapshot) if path: cmd.append(path) - output = restic.internal.command_executor.execute(cmd) + try: + restic.cat.config() + output = restic.internal.command_executor.execute(cmd) + except ResticFailedError as error: + if 'no snapshot found' in str(error): + err_msg = f'There is no snapshot {snapshot}' + if SERVICE: + err_msg += f'for the app {SERVICE}' + logging.error(err_msg) + exit(1) + else: + raise error output = output.replace('}\n{', '}|{') results = list(map(json.loads, output.split('|'))) return results