adding error handling
This commit is contained in:
@@ -101,7 +101,11 @@ def add_recurse(options):
|
|||||||
#if not is_listed(db,filename):
|
#if not is_listed(db,filename):
|
||||||
if file not in db_files:
|
if file not in db_files:
|
||||||
if options.add:
|
if options.add:
|
||||||
|
try:
|
||||||
add_single(conn,filename,change=False,minsize=options.minsize)
|
add_single(conn,filename,change=False,minsize=options.minsize)
|
||||||
|
except:
|
||||||
|
print('error adding file: '+filename)
|
||||||
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
if options.changed:
|
if options.changed:
|
||||||
ftime=os.path.getmtime(filename)
|
ftime=os.path.getmtime(filename)
|
||||||
@@ -109,7 +113,11 @@ def add_recurse(options):
|
|||||||
#if not hash_match(db,filename,hash):
|
#if not hash_match(db,filename,hash):
|
||||||
if not ftime_match(db,filename,ftime):
|
if not ftime_match(db,filename,ftime):
|
||||||
#file content changed
|
#file content changed
|
||||||
|
try:
|
||||||
add_single(conn,filename,change=True,minsize=options.minsize)
|
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
|
# if file mentioned, and hash same, no need to change entry
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user