confluentinc / confluent-kafka-go

Confluent's Apache Kafka Golang client
Apache License 2.0
4.67k stars 659 forks source link

Rest errors returned from the schema registry client are not in an internal package and as such cannot be checked by external packages #1300

Closed givanov closed 2 months ago

givanov commented 2 months ago

Description

Hello as part of the following change in v2.5.0: Move rest service for schema registry client into internal package for use by both the SR client and the DEK Registry client. The error being returned by the schema registry client is not in an internal package and as such things like the response code of errors can no longer be checked. Is this intentional or are there any plans on making the error accessible? Even more bizzare in 2.5.0 and 2.5.3 the public error interface is still available but is not used anymore so my exising code in steps to reproduce still works but since the error returned is different now does not achieve the desired effect.

How to reproduce

schema, err := schemaRegistryClient.GetLatestSchemaMetadata("test-schema")
if err != nil {
    restError := &schemaregistry.RestError{}
    if errors.As(err, &restError) {
    if restError.Code == 40401 {
            // error handling logic if schema does not exist
        }
    }

Checklist

Please provide the following information: