-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return protocol ID that is not supported in error message. #94
Comments
@marten-seemann yes this is particularly useful when debugging on multiple networks or performing upgrades where we upgrade the protocolID. |
That doesn't answer my question. You can easily annotate the error yourself: str, err := host.NewStream(ctx, peerID, proto)
if err != nil {
return fmt.Errorf("failed to open stream with proto %s: %w", proto, err)
} |
Adding two cents here, @marten-seemann. This is totally valid argument when you open or handle a new stream.
However, in the system, when a high-level operation consisting of multiple subprotocols fails, the error "protocol not supported" requires going over each protocol to understand where it's coming from. Of course, one could wrap the error in each protocol with its name, but it's still better to do it in one place. Also, add on the top @renaynay's point above multiple different networks, which are appended as suffixes to the protocol id. In the end, debugging something like this starts to be painful and simple mitigation is to add the protocol name. |
That's a fair point. Want to submit a PR? We should probably introduce an error type here, so you can get the list of protocols by using an error assertion. wdyt? type ErrNotSupport struct {
Protos []string
} |
@sukunrt are you interested in picking this up (other folks lmk if you've already started work on this)? |
Yes I'd like to pick this up. |
Here we need to change
which will include all the protocols which were not supported. |
I also see one usage in
This would also need to be generic, right? |
Yes. doReadHandshake will change. Agreed, ErrNotSupport should be generic otherwise it'll be a lot of string(proto). |
|
Migrating libp2p/go-libp2p#1988
The text was updated successfully, but these errors were encountered: