Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse_error_protobuf(text):
try:
message = common_pb2.WireMessage()
message.ParseFromString(text)
err = responses_pb2.ErrorResponse()
if not err.ParseFromString(message.wrapped_message):
raise Exception('No error message found')
except Exception:
# Not a protobuf error, fall through
return
parse_and_raise_sql_error(err.error_message)
raise_sql_error(err.error_code, err.sql_state, err.error_message)
# Not a protobuf error, fall through
def parse_error_protobuf(text):
message = common_pb2.WireMessage()
message.ParseFromString(text)
err = responses_pb2.ErrorResponse()
err.ParseFromString(message.wrapped_message)
parse_and_raise_sql_error(err.error_message)
raise_sql_error(err.error_code, err.sql_state, err.error_message)
raise errors.InternalError(err.error_message)
def parse_error_protobuf(text):
message = common_pb2.WireMessage()
message.ParseFromString(text)
err = responses_pb2.ErrorResponse()
err.ParseFromString(message.wrapped_message)
parse_and_raise_sql_error(err.error_message)
raise_sql_error(err.error_code, err.sql_state, err.error_message)
raise errors.InternalError(err.error_message)