mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-06 23:13:08 +00:00
Use the original protocol name for address missing errors
Reduces confusion due to aliased protocol names. License: MIT Signed-off-by: Matt Joiner <anacrolix@gmail.com>
This commit is contained in:
parent
73950681ca
commit
6f524a4380
5
codec.go
5
codec.go
@ -22,7 +22,8 @@ func stringToBytes(s string) ([]byte, error) {
|
|||||||
sp = sp[1:]
|
sp = sp[1:]
|
||||||
|
|
||||||
for len(sp) > 0 {
|
for len(sp) > 0 {
|
||||||
p := ProtocolWithName(sp[0])
|
name := sp[0]
|
||||||
|
p := ProtocolWithName(name)
|
||||||
if p.Code == 0 {
|
if p.Code == 0 {
|
||||||
return nil, fmt.Errorf("no protocol with name %s", sp[0])
|
return nil, fmt.Errorf("no protocol with name %s", sp[0])
|
||||||
}
|
}
|
||||||
@ -34,7 +35,7 @@ func stringToBytes(s string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(sp) < 1 {
|
if len(sp) < 1 {
|
||||||
return nil, fmt.Errorf("protocol requires address, none given: %s", p.Name)
|
return nil, fmt.Errorf("protocol requires address, none given: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.Path {
|
if p.Path {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user