Skip to content

Commit 54783c2

Browse files
ligurioTotktonada
authored andcommitted
lib: raise exception when path to snapshot is not found
1 parent d0805b4 commit 54783c2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import errno
12
import os
23
import sys
34
import collections
@@ -24,6 +25,9 @@
2425
PY3 = sys.version_info[0] == 3
2526
PY2 = sys.version_info[0] == 2
2627

28+
if PY2:
29+
FileNotFoundError = IOError
30+
2731
if PY3:
2832
string_types = str,
2933
integer_types = int,
@@ -302,6 +306,8 @@ def xlog_rows(xlog_path):
302306
303307
Assume tarantool and tarantoolctl is in PATH.
304308
"""
309+
if not os.path.exists(xlog_path):
310+
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), xlog_path)
305311
cmd = ['tarantoolctl', 'cat', xlog_path, '--format=json', '--show-system']
306312
with open(os.devnull, 'w') as devnull:
307313
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=devnull)

0 commit comments

Comments
 (0)