reports error string

This commit is contained in:
Andy Eschbacher 2016-09-02 16:39:35 -04:00
parent 2261d11de0
commit a6440f2ef7

View File

@ -38,10 +38,9 @@ def moran(subquery, attr_name,
if len(result) == 0: if len(result) == 0:
return pu.empty_zipped_array(2) return pu.empty_zipped_array(2)
plpy.notice('** Query returned with %d rows' % len(result)) plpy.notice('** Query returned with %d rows' % len(result))
except plpy.SPIError: except plpy.SPIError, e:
plpy.error('Error: areas of interest query failed, check input parameters') plpy.error('Query failed: %s' % e)
plpy.notice('** Query failed: "%s"' % query) plpy.notice('** Query failed: "%s"' % query)
plpy.notice('** Error: %s' % plpy.SPIError)
return pu.empty_zipped_array(2) return pu.empty_zipped_array(2)
## collect attributes ## collect attributes
@ -79,8 +78,8 @@ def moran_local(subquery, attr,
# if there are no neighbors, exit # if there are no neighbors, exit
if len(result) == 0: if len(result) == 0:
return pu.empty_zipped_array(5) return pu.empty_zipped_array(5)
except plpy.SPIError: except plpy.SPIError, e:
plpy.error('Error: areas of interest query failed, check input parameters') plpy.error('Query failed: %s' % e)
plpy.notice('** Query failed: "%s"' % query) plpy.notice('** Query failed: "%s"' % query)
return pu.empty_zipped_array(5) return pu.empty_zipped_array(5)
@ -119,10 +118,9 @@ def moran_rate(subquery, numerator, denominator,
if len(result) == 0: if len(result) == 0:
return pu.empty_zipped_array(2) return pu.empty_zipped_array(2)
plpy.notice('** Query returned with %d rows' % len(result)) plpy.notice('** Query returned with %d rows' % len(result))
except plpy.SPIError: except plpy.SPIError, e:
plpy.error('Error: areas of interest query failed, check input parameters') plpy.error('Query failed: %s' % e)
plpy.notice('** Query failed: "%s"' % query) plpy.notice('** Query failed: "%s"' % query)
plpy.notice('** Error: %s' % plpy.SPIError)
return pu.empty_zipped_array(2) return pu.empty_zipped_array(2)
## collect attributes ## collect attributes
@ -160,10 +158,9 @@ def moran_local_rate(subquery, numerator, denominator,
# if there are no neighbors, exit # if there are no neighbors, exit
if len(result) == 0: if len(result) == 0:
return pu.empty_zipped_array(5) return pu.empty_zipped_array(5)
except plpy.SPIError: except plpy.SPIError, e:
plpy.error('Error: areas of interest query failed, check input parameters') plpy.error('Query failed: %s' % e)
plpy.notice('** Query failed: "%s"' % query) plpy.notice('** Query failed: "%s"' % query)
plpy.notice('** Error: %s' % plpy.SPIError)
return pu.empty_zipped_array(5) return pu.empty_zipped_array(5)
## collect attributes ## collect attributes