Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

When a connection fails, the Pulsar client should return a detailed exception instead of a generic "connection error." #1315

Open
tinswzy opened this issue Dec 6, 2024 · 1 comment · May be fixed by #1320

Comments

@tinswzy
Copy link

tinswzy commented Dec 6, 2024

Expected behavior

When the Pulsar client connection fails, we hope to receive a more detailed and specific error message, such as:

WARN[0009] Failed to connect to broker. error="dial tcp [::1]:6650: connect: connection refused" remote_addr="pulsar://localhost:6650"

Actual behavior

pulsar go client return a a generic and unclear message when connection failed, like this:

connection error

Steps to reproduce

Connecting to an abnormal or non-started Pulsar.

System configuration

Pulsar version: master & latest release

@tinswzy
Copy link
Author

tinswzy commented Dec 6, 2024

For example, in the following code:

#pulsar/internal/connection.go 
type connection struct {
    logicalAddr  *url.URL
    physicalAddr *url.URL
}
......
func (c *connection) waitUntilReady() error {
    select {
    case <-c.readyCh:
       return nil
    case <-c.closeCh:
       // Connection has been closed while waiting for the readiness.
       return errors.New("connection error")
    }
}

To modify the errors.New statement to provide more detailed information, you can include additional context in the error message.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant