// AtoiOrPanic convert a string to int and panic if failed
178637
func AtoiOrPanic(str string) int {
	i, err := strconv.Atoi(str)
	if err != nil {
		log.Fatalf("%v is not valid integer string. err = %v", str, err)
	}
	return i
}
1257566
func (is *Is) ShouldPanic(f func()) {
	is.TB.Helper()
	defer func() {
		r := recover()
		if r == nil {
			fail(is, "expected function to panic")
		}
	}()
	f()
}
897080
func (vtg *VTGate) HandlePanic(err *error) {
	if x := recover(); x != nil {
		log.Errorf("Uncaught panic:\n%v\n%s", x, tb.Stack(4))
		*err = fmt.Errorf("uncaught panic: %v, vtgate: %v", x, servenv.ListeningURL.String())
		errorCounts.Add([]string{"Panic", "Unknown", "Unknown", vtrpcpb.Code_INTERNAL.String()}, 1)
	}
}
103853
func UnmarshalConfigOrPanic(data []byte) *cb.Config {
	result, err := UnmarshalConfig(data)
	if err != nil {
		panic(err)
	}
	return result
}
926591
func UnmarshalEnvelopeOrPanic(encoded []byte) *cb.Envelope {
	envelope, err := UnmarshalEnvelope(encoded)
	if err != nil {
		panic(err)
	}
	return envelope
}
360482
func (c *Config) Int(key string) (int, error) {
	return strconv.Atoi(c.get(key))
}
385649
func validateInt(v string) error {
	if v == "" {
		return nil
	}
	_, err := strconv.Atoi(v)
	return err
}
636038
func checkResourcesOrPanic(res channelconfig.Resources) {
	if err := checkResources(res); err != nil {
		logger.Panicf("[channel %s] %s", res.ConfigtxValidator().ChainID(), err)
	}
}
1150412
func LogPanicWithStack(log Interface, location string, r interface{}, vals ...interface{}) error {
	if log == nil {
		log = internal
	}
	var err error
	switch t := r.(type) {
	case string:
		err = errors.New(t)
	case error:
		err = t
	default:
		err = errors.Errorf("unkown type(%T) error: %v", r, r)
	}
	os.Mkdir("panics", os.ModePerm)
	b, tmpErr := ioutil.TempFile("panics", location)
	if tmpErr != nil {
		log.Log("event", "panic", "location", location, "err", err, "warning", "no temp file", "tmperr", tmpErr)
		return errors.Wrapf(tmpErr, "LogPanic: failed to create httpRecovery log")
	}

	fmt.Fprintf(b, "warning! %s!\nError:\n%+v\n", location, err)
	for i, v := range vals {
		spew.Fdump(b, "val(%d): %#v\n", i, v)
	}
	fmt.Fprintf(b, "\n\nCall Stack:\n%s", debug.Stack())

	log.Log("event", "panic", "location", location, "panicLog", b.Name())
	fmt.Fprintf(os.Stderr, "panicWithStack: wrote %s\n", b.Name())

	return errors.Wrap(b.Close(), "LogPanic: failed to close dump file")
}
640986
func (v *variable) intValue() int {
	i, err := strconv.Atoi(v.value)
	if err != nil {
		panic("unexpected value " + v.value + " for int ")
	}
	return i
}
297629
func LocatePanic(r interface{}) (file string, line int, funcName string) {
	defer func() {
		// Be safe in here
		recover()
	}()
	var pc [16]uintptr

	// Need to start 4 deep
	n := runtime.Callers(4, pc[:])
	for _, pc := range pc[:n] {
		fn := runtime.FuncForPC(pc)
		if fn == nil {
			continue
		}
		file, line = fn.FileLine(pc)
		funcName = fn.Name()
		if !strings.HasPrefix(funcName, "runtime.") {
			break
		}
	}

	return file, line, funcName
}
241046
func (v Value) Int() (int, error) {
	i, err := strconv.Atoi(v.String())
	if err != nil {
		return 0, v.invalidTypeError(err, "int")
	}
	return i, nil
}
1327687
func (c *IniConfigContainer) Int(key string) (int, error) {
	return strconv.Atoi(c.getdata(key))
}
295491
func extractInt(s string) (int, error) {
	if s == "" {
		return 0, nil
	}
	return strconv.Atoi(s)
}
20286
func secp256k1GoPanicIllegal(msg *C.char, data unsafe.Pointer) {
	panic("illegal argument: " + C.GoString(msg))
}
660721
func FullyQualifiedHostnameOrPanic() string {
	hostname, err := FullyQualifiedHostname()
	if err != nil {
		panic(err)
	}
	return hostname
}
699623
func atois(strs []string) ([]int, error) {
	var a []int
	for _, str := range strs {
		i, err := strconv.Atoi(str)
		if err != nil {
			return nil, err
		}
		a = append(a, i)
	}
	return a, nil
}