From a6440f2ef7d98c7f2477806b9c8ce5efb9b165b8 Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Fri, 2 Sep 2016 16:39:35 -0400 Subject: [PATCH] reports error string --- .../crankshaft/crankshaft/clustering/moran.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/py/crankshaft/crankshaft/clustering/moran.py b/src/py/crankshaft/crankshaft/clustering/moran.py index 3282f5f..a524892 100644 --- a/src/py/crankshaft/crankshaft/clustering/moran.py +++ b/src/py/crankshaft/crankshaft/clustering/moran.py @@ -38,10 +38,9 @@ def moran(subquery, attr_name, if len(result) == 0: return pu.empty_zipped_array(2) plpy.notice('** Query returned with %d rows' % len(result)) - except plpy.SPIError: - plpy.error('Error: areas of interest query failed, check input parameters') + except plpy.SPIError, e: + plpy.error('Query failed: %s' % e) plpy.notice('** Query failed: "%s"' % query) - plpy.notice('** Error: %s' % plpy.SPIError) return pu.empty_zipped_array(2) ## collect attributes @@ -79,8 +78,8 @@ def moran_local(subquery, attr, # if there are no neighbors, exit if len(result) == 0: return pu.empty_zipped_array(5) - except plpy.SPIError: - plpy.error('Error: areas of interest query failed, check input parameters') + except plpy.SPIError, e: + plpy.error('Query failed: %s' % e) plpy.notice('** Query failed: "%s"' % query) return pu.empty_zipped_array(5) @@ -119,10 +118,9 @@ def moran_rate(subquery, numerator, denominator, if len(result) == 0: return pu.empty_zipped_array(2) plpy.notice('** Query returned with %d rows' % len(result)) - except plpy.SPIError: - plpy.error('Error: areas of interest query failed, check input parameters') + except plpy.SPIError, e: + plpy.error('Query failed: %s' % e) plpy.notice('** Query failed: "%s"' % query) - plpy.notice('** Error: %s' % plpy.SPIError) return pu.empty_zipped_array(2) ## collect attributes @@ -160,10 +158,9 @@ def moran_local_rate(subquery, numerator, denominator, # if there are no neighbors, exit if len(result) == 0: return pu.empty_zipped_array(5) - except plpy.SPIError: - plpy.error('Error: areas of interest query failed, check input parameters') + except plpy.SPIError, e: + plpy.error('Query failed: %s' % e) plpy.notice('** Query failed: "%s"' % query) - plpy.notice('** Error: %s' % plpy.SPIError) return pu.empty_zipped_array(5) ## collect attributes