Skip to content

Commit

Permalink
added exception handler during indexing, for duplicate paths
Browse files Browse the repository at this point in the history
  • Loading branch information
C. Bess committed Dec 16, 2012
1 parent 110e9b2 commit 4669856
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions core/sherlock/__init__.py
Expand Up @@ -2,6 +2,9 @@
__init__.py
Created by: Christopher Bess
Copyright: 2011
refs:
http://docs.python.org/2/library/logging.html
"""
__version__ = '0.7.3'

Expand Down
18 changes: 12 additions & 6 deletions core/sherlock/db.py
Expand Up @@ -18,6 +18,7 @@
from core import peewee
from core import settings, FULL_INDEXES_PATH
from core.utils import debug
from core.sherlock import logger

try:
import sqlite3
Expand Down Expand Up @@ -97,12 +98,17 @@ def is_file_updated(filepath, check_file_exists=False, update_db=False):
record.save()
else:
if update_db:
record = IndexerMeta.create(
path=filepath,
mod_date=last_mod_dt,
date_added=datetime.now()
)
return True, record
try:
record = IndexerMeta.create(
path=filepath,
mod_date=last_mod_dt,
date_added=datetime.now()
)
return True, record
except sqlite3.IntegrityError, e:
# column path may not be unique
logger.error('%s - filepath: %s' % (e, filepath))
pass
return has_file_changed, record


Expand Down

0 comments on commit 4669856

Please sign in to comment.