diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py index a9646ed546e5..50c73f7be5be 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py @@ -532,7 +532,6 @@ def upsert_entity( # pylint:disable=R1710 partition_key = entity['PartitionKey'] row_key = entity['RowKey'] entity = _add_entity_properties(entity) - try: metadata = None if mode is UpdateMode.MERGE: @@ -556,10 +555,5 @@ def upsert_entity( # pylint:disable=R1710 raise ValueError("""Update mode {} is not supported. For a list of supported modes see the UpdateMode enum""".format(mode)) return _trim_service_metadata(metadata) - except ResourceNotFoundError: - return self.create_entity( - partition_key=partition_key, - row_key=row_key, - table_entity_properties=entity, - **kwargs - ) + except HttpResponseError as error: + _process_table_error(error) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py index 1eda813a4c62..2f4837fb1271 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py @@ -567,10 +567,5 @@ async def upsert_entity( raise ValueError("""Update mode {} is not supported. For a list of supported modes see the UpdateMode enum""".format(mode)) return _trim_service_metadata(metadata) - except ResourceNotFoundError: - return await self.create_entity( - partition_key=partition_key, - row_key=row_key, - table_entity_properties=entity, - **kwargs - ) + except HttpResponseError as error: + _process_table_error(error)