adding error handling

This commit is contained in:
q
2013-07-05 18:41:34 +03:00
parent 26d65646ef
commit 150bcec6b8

View File

@@ -101,7 +101,11 @@ def add_recurse(options):
#if not is_listed(db,filename):
if file not in db_files:
if options.add:
try:
add_single(conn,filename,change=False,minsize=options.minsize)
except:
print('error adding file: '+filename)
sys.exit(1)
else:
if options.changed:
ftime=os.path.getmtime(filename)
@@ -109,7 +113,11 @@ def add_recurse(options):
#if not hash_match(db,filename,hash):
if not ftime_match(db,filename,ftime):
#file content changed
try:
add_single(conn,filename,change=True,minsize=options.minsize)
except:
print('error changing file: '+filename)
sys.exit(1)
# if file mentioned, and hash same, no need to change entry
conn.commit()
return