mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 15:04:22 +00:00
libs/common: remove deprecated PanicXXX functions (#3595)
* Remove deprecated PanicXXX functions from codebase As per discussion over [here](https://github.com/tendermint/tendermint/pull/3456#discussion_r278423492), we need to remove these `PanicXXX` functions and eliminate our dependence on them. In this PR, each and every `PanicXXX` function call is replaced with a simple `panic` call. * add a changelog entry
This commit is contained in:
committed by
Anton Kaliaev
parent
90997ab1b5
commit
70592cc4d8
@@ -707,7 +707,7 @@ type Channel struct {
|
||||
func newChannel(conn *MConnection, desc ChannelDescriptor) *Channel {
|
||||
desc = desc.FillDefaults()
|
||||
if desc.Priority <= 0 {
|
||||
cmn.PanicSanity("Channel default priority must be a positive integer")
|
||||
panic("Channel default priority must be a positive integer")
|
||||
}
|
||||
return &Channel{
|
||||
conn: conn,
|
||||
|
||||
+1
-3
@@ -14,8 +14,6 @@ import (
|
||||
"time"
|
||||
|
||||
"errors"
|
||||
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
)
|
||||
|
||||
// NetAddress defines information about a peer on the network
|
||||
@@ -48,7 +46,7 @@ func NewNetAddress(id ID, addr net.Addr) *NetAddress {
|
||||
tcpAddr, ok := addr.(*net.TCPAddr)
|
||||
if !ok {
|
||||
if flag.Lookup("test.v") == nil { // normal run
|
||||
cmn.PanicSanity(fmt.Sprintf("Only TCPAddrs are supported. Got: %v", addr))
|
||||
panic(fmt.Sprintf("Only TCPAddrs are supported. Got: %v", addr))
|
||||
} else { // in testing
|
||||
netAddr := NewNetAddressIPPort(net.IP("0.0.0.0"), 0)
|
||||
netAddr.ID = id
|
||||
|
||||
+2
-2
@@ -53,14 +53,14 @@ func (a *addrBook) loadFromFile(filePath string) bool {
|
||||
// Load addrBookJSON{}
|
||||
r, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
cmn.PanicCrisis(fmt.Sprintf("Error opening file %s: %v", filePath, err))
|
||||
panic(fmt.Sprintf("Error opening file %s: %v", filePath, err))
|
||||
}
|
||||
defer r.Close() // nolint: errcheck
|
||||
aJSON := &addrBookJSON{}
|
||||
dec := json.NewDecoder(r)
|
||||
err = dec.Decode(aJSON)
|
||||
if err != nil {
|
||||
cmn.PanicCrisis(fmt.Sprintf("Error reading file %s: %v", filePath, err))
|
||||
panic(fmt.Sprintf("Error reading file %s: %v", filePath, err))
|
||||
}
|
||||
|
||||
// Restore all the fields...
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ func (sw *Switch) AddReactor(name string, reactor Reactor) Reactor {
|
||||
for _, chDesc := range reactorChannels {
|
||||
chID := chDesc.ID
|
||||
if sw.reactorsByCh[chID] != nil {
|
||||
cmn.PanicSanity(fmt.Sprintf("Channel %X has multiple reactors %v & %v", chID, sw.reactorsByCh[chID], reactor))
|
||||
panic(fmt.Sprintf("Channel %X has multiple reactors %v & %v", chID, sw.reactorsByCh[chID], reactor))
|
||||
}
|
||||
sw.chDescs = append(sw.chDescs, chDesc)
|
||||
sw.reactorsByCh[chID] = reactor
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ func (tms *TrustMetricStore) loadFromDB() bool {
|
||||
peers := make(map[string]MetricHistoryJSON)
|
||||
err := json.Unmarshal(bytes, &peers)
|
||||
if err != nil {
|
||||
cmn.PanicCrisis(fmt.Sprintf("Could not unmarshal Trust Metric Store DB data: %v", err))
|
||||
panic(fmt.Sprintf("Could not unmarshal Trust Metric Store DB data: %v", err))
|
||||
}
|
||||
|
||||
// If history data exists in the file,
|
||||
|
||||
Reference in New Issue
Block a user