confluentinc / confluent-kafka-dotnet

Confluent's Apache Kafka .NET client
https://github.com/confluentinc/confluent-kafka-dotnet/wiki
Apache License 2.0
2.78k stars 847 forks source link

Schema Registry Exception details missing #2156

Open cyandaniel opened 6 months ago

cyandaniel commented 6 months ago

Description

We tried to produce messages from a docker container behind a company proxy to an internal host. Due to system environment misconfiguration the schema client connection to the registy is made through that proxy. The response from the proxy was an HTML web page with the content "DNS Error. Please contact..."

The RestClient throws an SchemaRegistryException with no message, erroCode = -1 and status = null. So its a little bit hard to find out whats going on.

A possible solution could be to add the exception that is currently being caught but not processed as an InnerException to the SchemaRegistryException.

How to reproduce

Checklist

Please provide the following information:

pfeigl commented 6 months ago

The relevant code should be this here where the exception is caught but completely discarded https://github.com/confluentinc/confluent-kafka-dotnet/blob/a67bd6c06b7eef4293e6476d9ff6f3e93f0e4cd9/src/Confluent.SchemaRegistry/Rest/RestService.cs#L201

Also while looking into this. Why does the SchemaRegistryException have it's own Status property and does not use the StatsCode property of the base HttpRequestException class?