replace errors.go with github.com/pkg/errors (2/2) (#3890)

* init of (2/2) common errors

* Remove instances of cmn.Error (2/2)

- Replace usage of cmnError and errorWrap
- ref #3862

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* comment wording

* simplify IsErrXXX functions

* log panic along with stopping the MConnection
This commit is contained in:
Marko
2019-08-11 19:03:40 +02:00
committed by Anton Kaliaev
parent 8dc39b69b7
commit 8a282a5fee
14 changed files with 75 additions and 88 deletions

View File

@@ -4,6 +4,8 @@ import (
"fmt"
"net"
"github.com/pkg/errors"
"github.com/tendermint/tendermint/crypto/ed25519"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
@@ -13,15 +15,14 @@ import (
// report that a connection timeout occurred. This detects both fundamental
// network timeouts, as well as ErrConnTimeout errors.
func IsConnTimeout(err error) bool {
if cmnErr, ok := err.(cmn.Error); ok {
if cmnErr.Data() == ErrConnectionTimeout {
return true
}
}
if _, ok := err.(timeoutError); ok {
switch errors.Cause(err).(type) {
case EndpointTimeoutError:
return true
case timeoutError:
return true
default:
return false
}
return false
}
// NewSignerListener creates a new SignerListenerEndpoint using the corresponding listen address