Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eventerror: don't explode on missing keys while formatting #4362

Merged
merged 1 commit into from
Oct 14, 2016

Conversation

mattrobenolt
Copy link
Contributor

This helps as messages evolve over time. Previous events will be stored
without keys that are needed if the message in turn, now expects it.
This allows things to gracefully roll forward.

@getsentry/platform

from string import Formatter


class dontexplodedict(dict):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't subclass dict. this means we copy out the thing for no good reason. Alternatively proposal:

class X(object):
 def __init__(self, x):
  self.x = x
 def __getitem__(self, x):
  try:
   return self.x[x]
  except LookupError:
   return ''

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

This helps as messages evolve over time. Previous events will be stored
without keys that are needed if the message in turn, now expects it.
This allows things to gracefully roll forward.
@mattrobenolt mattrobenolt merged commit 833f152 into master Oct 14, 2016
@mattrobenolt mattrobenolt deleted the lolformat branch October 14, 2016 01:07
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants