func (ec ErrorConnection) Error() string {
	return "connection error: " + string(ec)
}
Error satisfies the Error interface for the ErrorConnection type.
package host
import (
	"errors"
	"strings"
	"sync/atomic"
	"github.com/NebulousLabs/fastrand"
)
const (
	errorCommunicationProbability = 5
	errorConnectionProbability    = 20
	errorConsensusProbability     = 1
	errorInternalProbability      = 3
	errorNormalProbability        = 20
)
type (
	ErrorCommunication string
	ErrorConnection string
	ErrorConsensus string
	ErrorInternal string
)
func composeErrors(errs ...error) error {
	var errStrings []string
	for _, err := range errs {
		if err != nil {
			errStrings = append(errStrings, err.Error())
		}
	}
	if len(errStrings) <= 0 {
		return nil
	}
	return errors.New(strings.Join(errStrings, "; "))
}
func extendErr(s string, err error) error {
	if err == nil {
		return nil
	}
	switch v := err.(type) {
	case ErrorCommunication:
		return ErrorCommunication(s) + v
	case ErrorConnection:
		return ErrorConnection(s) + v
	case ErrorConsensus:
		return ErrorConsensus(s) + v
	case ErrorInternal:
		return ErrorInternal(s) + v
	default:
		return errors.New(s + err.Error())
	}
}
func (ec ErrorCommunication) Error() string {
	return "communication error: " + string(ec)
}