diff --git a/src/confluent_kafka/schema_registry/schema_registry_client.py b/src/confluent_kafka/schema_registry/schema_registry_client.py index 2e40131ac..b03610c6c 100644 --- a/src/confluent_kafka/schema_registry/schema_registry_client.py +++ b/src/confluent_kafka/schema_registry/schema_registry_client.py @@ -458,12 +458,16 @@ def delete_subject(self, subject_name, permanent=False): `DELETE Subject API Reference `_ """ # noqa: E501 - list = self._rest_client.delete('subjects/{}' - .format(_urlencode(subject_name))) + try: + list = self._rest_client.delete('subjects/{}' + .format(_urlencode(subject_name))) + except SchemaRegistryError as e: + if e.error_code != 40404: + raise if permanent: - self._rest_client.delete('subjects/{}?permanent=true' - .format(_urlencode(subject_name))) + list = self._rest_client.delete('subjects/{}?permanent=true' + .format(_urlencode(subject_name))) return list