Save line if present when storing object errors
This commit is contained in:
parent
7113466760
commit
6cf7f79942
|
@ -111,15 +111,19 @@ class SpatialHarvester(object):
|
||||||
finally:
|
finally:
|
||||||
log.error(message)
|
log.error(message)
|
||||||
|
|
||||||
def _save_object_error(self,message,obj,stage=u'Fetch'):
|
def _save_object_error(self,message,obj,stage=u'Fetch',line=None):
|
||||||
err = HarvestObjectError(message=message,object=obj,stage=stage)
|
err = HarvestObjectError(message=message,
|
||||||
|
object=obj,
|
||||||
|
stage=stage,
|
||||||
|
line=line)
|
||||||
try:
|
try:
|
||||||
err.save()
|
err.save()
|
||||||
except InvalidRequestError,e:
|
except InvalidRequestError,e:
|
||||||
Session.rollback()
|
Session.rollback()
|
||||||
err.save()
|
err.save()
|
||||||
finally:
|
finally:
|
||||||
log.error(message)
|
log_message = '{0}, line {1}'.format(message,line) if line else message
|
||||||
|
log.error(log_message)
|
||||||
|
|
||||||
def _get_content(self, url):
|
def _get_content(self, url):
|
||||||
url = url.replace(' ','%20')
|
url = url.replace(' ','%20')
|
||||||
|
|
Loading…
Reference in New Issue