schugschug avatar schugschug committed 49661e0

improve error message debugging

Comments (0)

Files changed (5)


         if hash_key not in
-            raise KeyError('hash_key={} not found'.format(hash_key))
+            raise KeyError('in {} hash_key={} not found {}'.format(,hash_key,
         if range_key is None:
         if range_key not in[hash_key]:


         if start and start['HashKeyElement'] != hash_key:
             raise ValidationException("'HashKeyElement' element of 'ExclusiveStartKey' must be the same as the hash_key. Expected {}, got {}".format(hash_key, start['HashKeyElement']))
-        data =[hash_value, None]
+        try:
+            data =[hash_value, None]
+        except KeyError:
+            data = {}
         keys = sorted(data.keys())


 def load_table(func):
     def loader(post, *args):
+        import inspect
         name = post[u'TableName']
         table = dynamodb.get_table(name)
         return func(post, table, *args)
     return loader


         answer = func(post)
         #req_logger.debug("request_id=%s action=%s answer=%s", post['request_id'], action, answer)
         return answer
-    except (TypeError, ValueError, KeyError) as e:
+    except (TypeError, ValueError, SyntaxError) as e:
+        import traceback
         req_logger.error('C request_id=%s action=%s exception=%s body=%s post=%s', request_id, action, type(e).__name__, str(e.args),post)
+        req_logger.error(traceback.format_exc(limit=7))
         raise InternalFailure("{}: {}".format(type(e).__name__, str(e.args)))

"%s: interval=%s min=%s max=%s average=%s",
-                       min(points),
-                       max(points),
-                       average(points))
+                       min(points) if points else 'N/A',
+                       max(points) if points else 'N/A',
+                       average(points) if points else 'N/A')
         self.current_point_list = []
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.