Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
result['diagnostics'] = encoded_diagnostics
if profile is not None:
result['profile'] = profile
try:
return bser.dumps(result)
except Exception as e:
# Try again without the values
result['values'] = []
if 'diagnostics' not in result:
result['diagnostics'] = []
result['diagnostics'].append({
'message': format_traceback_and_exception(),
'level': 'fatal',
'source': 'parse',
})
return bser.dumps(result)