Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def validate_context(msg):
try:
yield
except ValidationError as e:
_, _, tb = sys.exc_info()
raise ValidationError(e, ctx=msg).with_traceback(tb)