Browse files

Improved error handling for parsing errors

  • Loading branch information...
1 parent 41d9b7e commit 412565a57fae1e4e3151e1f893e095652abea556 @cdman cdman committed Jan 24, 2013
Showing with 5 additions and 3 deletions.
  1. +2 −1 appstats_profiler.py
  2. +1 −1 unformatter/__init__.py
  3. +2 −1 unformatter/examples.txt
View
3 appstats_profiler.py
@@ -96,7 +96,8 @@ def results(self):
request_pretty = pformat(request_object)
response_pretty = pformat(response_object)
except Exception, e:
- logging.warning("Prettifying RPC calls failed.\n%s", e)
+ logging.warning("Prettifying RPC calls failed.\n%s\nRequest: %s\nResponse: %s",
+ e, request, response, exc_info=True)
service_totals_dict[service_prefix]["total_misses"] += miss
View
2 unformatter/__init__.py
@@ -27,7 +27,7 @@ def _parse_string(text, quote_char):
end = text.index(quote_char)
while text[end-1] == "\\":
end = text.index(quote_char, end+1)
- return text[:end].decode('string_escape'), text[end+1:]
+ return text[:end].decode('string_escape', 'ignore'), text[end+1:]
def _parse_list(text):
View
3 unformatter/examples.txt
@@ -12,4 +12,5 @@ MemcacheGetRequest<has_name_space_=1, key_=['__layer_cache_badges.util_badges.al
MemcacheGetResponse<item_=[MemcacheGetResponse_Item<flags_=2, has_flags_=1, has_key_=1, has_value_=1, key_='__layer_cache_badges.util_badges.all_badges_dict__', value_="\x80\x02}q\x01(U\x17toplevelalgebraistbadgeq\x02cbadges.exercise_completion_badges\nTopLevelAlgebraistBadge\nq\x03)\x81q\x04}q\x05(U\x04nameq\x06h\x02U\x14is_teaser_if_unknownq\x07\x89U\x12badge_context_typeq\x08K\x00U\x0ebadge_categoryq\tK\x05U\x08is_ownedq\n\x89U\x06pointsq\x0bM\x10'U\x14is_hidden_if_unknownq\x0c\x89U\x17exercise_names_requiredq\r]q\x0eU\x11algebra_challengeq\x0faU\x0bdes...ger|\x01\x00\x00cbadges.unfinished_streak_problem_badges\nSoCloseBadge\nr}\x01\x00\x00)\x81r~\x01\x00\x00}r\x7f\x01\x00\x00(h\x06j|\x01\x00\x00h\x07\x89h\x08K\x01h\tK\x00h\n\x89h\x0bK\x00h\x0c\x89hJK\x1eh\x10U\x0cPerseverancer\x80\x01\x00\x00ubU\x11undeterrablebadger\x81\x01\x00\x00cbadges.unfinished_streak_problem_badges\nUndeterrableBadge\nr\x82\x01\x00\x00)\x81r\x83\x01\x00\x00}r\x84\x01\x00\x00(h\x06j\x81\x01\x00\x00h\x07\x89h\x08K\x01h\tK\x01h\n\x89h\x0bK\x00h\x0c\x89hJK2h\x10U\x08Tenacityr\x85\x01\x00\x00ubu.">]>
MemcacheGetRequest<has_name_space_=1, key_=['__layer_cache_badges.util_badges.all_badges_dict__'], lazy_init_lock_=LockType<locked_status=False>, name_space_='764.1'>
MemcacheGetResponse<item_=[MemcacheGetResponse_Item<flags_=2, has_flags_=1, has_key_=1, has_value_=1, key_='__layer_cache_badges.util_badges.all_badges_dict__', value_="\x80\x02}q\x01(U\x17toplevelalgebraistbadgeq\x02cbadges.exercise_completion_badges\nTopLevelAlgebraistBadge\nq\x03)\x81q\x04}q\x05(U\x04nameq\x06h\x02U\x14is_teaser_if_unknownq\x07\x89U\x12badge_context_typeq\x08K\x00U\x0ebadge_categoryq\tK\x05U\x08is_ownedq\n\x89U\x06pointsq\x0bM\x10'U\x14is_hidden_if_unknownq\x0c\x89U\x17exercise_names_requiredq\r]q\x0eU\x11algebra_challengeq\x0faU\x0bdes...ger|\x01\x00\x00cbadges.unfinished_streak_problem_badges\nSoCloseBadge\nr}\x01\x00\x00)\x81r~\x01\x00\x00}r\x7f\x01\x00\x00(h\x06j|\x01\x00\x00h\x07\x89h\x08K\x01h\tK\x00h\n\x89h\x0bK\x00h\x0c\x89hJK\x1eh\x10U\x0cPerseverancer\x80\x01\x00\x00ubU\x11undeterrablebadger\x81\x01\x00\x00cbadges.unfinished_streak_problem_badges\nUndeterrableBadge\nr\x82\x01\x00\x00)\x81r\x83\x01\x00\x00}r\x84\x01\x00\x00(h\x06j\x81\x01\x00\x00h\x07\x89h\x08K\x01h\tK\x01h\n\x89h\x0bK\x00h\x0c\x89hJK2h\x10U\x08Tenacityr\x85\x01\x00\x00ubu.">]>
-PutRequest<entity=[EntityProto<entity_group=Path<>, key=Reference<app='foobard', path=Path<element=[Path_Element<id=0, type='Permissions'>]>>, property=[Property<multiple=False, name='name', value=PropertyValue<>>], raw_property=[Property<meaning=14, multiple=False, name='models', value=PropertyValue<stringvalue=Blob<'\\x80\\x02}q\\x00.'>>>]>]>
+PutRequest<entity=[EntityProto<entity_group=Path<>, key=Reference<app='foobard', path=Path<element=[Path_Element<id=0, type='Permissions'>]>>, property=[Property<multiple=False, name='name', value=PropertyValue<>>], raw_property=[Property<meaning=14, multiple=False, name='models', value=PropertyValue<stringvalue=Blob<'\\x80\\x02}q\\x00.'>>>]>]>
+MemcacheGetResponse<item=[Item<key='trove.v7:nodes_0.v1:ag1zfnVkYWNpdHktZGV2cg8LEgROb2RlIgVlcDI0NQw', value='\x80\x02csrc.core.trove.stashes\n_CacheEntry\nq\x01)\x81q\x02(T\xab\t\x00\x00x\xda\xbdX\x0bTLk\x1bnO5\xcdTS)\xa5\xb6C#\x9d\x9a\xa2\xa1$!\x87\xe4\x16S\x89\x86R\x8cm\xcf\xd6l\xe6\xba\xf7L\x97\x89\xe4\x12\x15\xba\x90#L\x14I\xae\x95ksrB\x18"\x15\xb9\x96[9r\xe9H\x11\x11:g\xd7\xb4\xfc\xfes\x96\xffo\xc6b\xaf5k\xcd|\xdf\xf...2\xa1\x1e\xed\xb5\'\xd8\xfb\x87{0om\xc6U\r\n}\xde7z\x90\xfa?\n\xfd\x97}\xe9\xcf\x14SP_\x8aJ\xf9\x9dZZ\x83VSD\x91t\xa9\x88>^F\x8c8t\x88>S\naR\x99x\x05\xf0\xcf?\xb4\x17\xe0\xcc\xbf\x01\xfa$l7\x88\x86q\x03cdatetime\ndatetime\nq\x04U\n\x07\xdd\x01\x1e\x13\x14#\x05h\xce\x85Rq\x05M\xe7\x17G?\xd4\xb7\x81\x00\x00\x00\x00tb.', ...>, ...]>

0 comments on commit 412565a

Please sign in to comment.