Skip to content

Commit

Permalink
Merge pull request #21 from libp2p/fix/annotate-pnet-bad-key-error
Browse files Browse the repository at this point in the history
annotate the "malformed key" error from pnet protector
  • Loading branch information
Kubuxu authored Apr 20, 2018
2 parents 02aa648 + cec0aa6 commit 11f3d9b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p2p/net/pnet/protector.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pnet

import (
"fmt"
"io"

ipnet "github.com/libp2p/go-libp2p-interface-pnet"
Expand All @@ -14,7 +15,7 @@ var _ ipnet.Protector = (*protector)(nil)
func NewProtector(input io.Reader) (ipnet.Protector, error) {
psk, err := decodeV1PSK(input)
if err != nil {
return nil, err
return nil, fmt.Errorf("malformed private network key: %s", err)
}
return NewV1ProtectorFromBytes(psk)
}
Expand Down

0 comments on commit 11f3d9b

Please sign in to comment.