/*
BeError checks that the provided error is not nil

The return value will be true iff error is not nil

Additional output for any error message can be provided as additional parameters, as with fmt.Print.
*/
762260
func BeError(t TestingT, got error, a ...interface{}) bool {
	t.Helper()
	mt := Tester{T: t}
	return mt.BeError(got, a...)
}
109112
func (errs forwardErrors) Error() string {
	// Only print 10 errors
	strsLen := len(errs)
	if len(errs) > 10 {
		strsLen = 10
	}

	// convert the errors into a slice of strings
	strs := make([]string, strsLen)
	for i, err := range errs[:len(strs)] {
		strs[i] = err.Error()
	}

	// If there are errors that weren't printed, add a message to the end
	str := strings.Join(strs, "\n * ")
	if len(strs) < len(errs) {
		str += fmt.Sprintf("\nand %d more...", len(errs)-len(strs))
	}

	return str
}
1019858
func IsError(t types.Type) bool {
	typ, ok := t.(*types.Named)
	if !ok {
		return false
	}
	if typ.Obj().Name() == "error" {
		return true
	}
	for i := 0; i < typ.NumMethods(); i++ {
		meth := typ.Method(i)
		if meth.Name() != "Error" {
			continue
		}
		sig, ok := meth.Type().(*types.Signature)
		if !ok {
			// impossible, but lets check anyway
			continue
		}
		if sig.Params().Len() != 0 {
			continue
		}
		res := sig.Results()
		if res.Len() != 1 {
			continue
		}
		b, ok := res.At(0).Type().(*types.Basic)
		if !ok {
			continue
		}
		if b.Kind() != types.String {
			continue
		}
		return true
	}
	return false
}
908504
func IsError(err, errConst error) bool {
	if err == errConst {
		return true
	}
	// Must rely on string equivalence, otherwise a value is not equal
	// to its pointer value.
	rootErrStr := ""
	rootErr := RootError(err)
	if rootErr != nil {
		rootErrStr = rootErr.Error()
	}
	errConstStr := ""
	if errConst != nil {
		errConstStr = errConst.Error()
	}
	return rootErrStr == errConstStr
}
299516
func Error(err error) {
	logger.Error(fmt.Sprintf("error: %v", err))
	os.Exit(1)
}
1363273
func (s *SimpleLogger) Error(v ...interface{}) {
	if s.level <= core.LOG_ERR {
		s.ERR.Output(2, fmt.Sprint(v...))
	}
	return
}
747220
func (es MultiError) Error() string {
	var buf bytes.Buffer

	if len(es) > 1 {
		fmt.Fprintf(&buf, "%d errors: ", len(es))
	}

	for i, err := range es {
		if i != 0 {
			buf.WriteString("; ")
		}
		buf.WriteString(err.Error())
	}

	return buf.String()
}
1033291
func (cl *Call) Error(arguments ...interface{}) {
	cl.scope.log(cl.entry, fmt.Sprintln(arguments...))
	cl.scope.t.Fail()
}
1318889
func IsNoResultsError(err error) bool {
	switch errType := errors.Cause(err).(type) {
	case NoResultsError:
		return errType.NoResultsError()
	default:
		return false
	}
}
1146466
func (m *MultiError) Error() string {
	var buf bytes.Buffer

	if len(m.Errors) == 1 {
		buf.WriteString("1 error: ")
	} else {
		fmt.Fprintf(&buf, "%d errors: ", len(m.Errors))
	}

	for i, err := range m.Errors {
		if i != 0 {
			buf.WriteString("; ")
		}

		buf.WriteString(err.Error())
	}

	return buf.String()
}
72832
func Error(format string, args ...interface{}) {
	if len(args) == 0 {
		fmt.Fprintln(ErrorWriter, format)
		return
	}
	fmt.Fprintf(ErrorWriter, format+"\n", args...)
}
1021660
func CheckError(err error, level int) {
	if err != nil {
		var stack [4096]byte
		runtime.Stack(stack[:], false)
		log.Printf("%q\n%s\n", err, stack[:])

		switch level {
		case 0:
			glog.Infoln("%q\n%s\n", err)
		case 1:
			glog.Warningln("%q\n%s\n", err)
		case 2:
			glog.Errorln("%q\n%s\n", err)
		case 3:
			glog.Fatalln("%q\n%s\n", err)
		}

		glog.Flush()
	}
}
1103871
func (e *ErrorObject) Error() string {
	err := fmt.Sprintf("%v error", e.Code)
	if e.Field != "" {
		err = fmt.Sprintf("%v caused by %v field", err, e.Field)
	}
	err = fmt.Sprintf("%v on %v resource", err, e.Resource)
	if e.Message != "" {
		err = fmt.Sprintf("%v: %v", err, e.Message)
	}

	return err
}
896474
func checkError(response []byte) error {
	var mwerror mwError
	err := json.Unmarshal(response, &mwerror)
	if err != nil {
		return nil
	} else if mwerror.Error.Code != "" {
		return errors.New(mwerror.Error.Code + ": " + mwerror.Error.Info)
	} else {
		return nil
	}
}
372707
func (c *ConversionError) Error() string {
	return spew.Sprintf(
		"Conversion error: %s. (in: %v(%+v) out: %v)",
		c.Message, reflect.TypeOf(c.In), c.In, reflect.TypeOf(c.Out),
	)
}
917646
func (p *printer) Error(err error) {
	st, _ := status.FromError(err)
	p.f("%s", st.Message())
}
1187919
func (c *Subcommand) printError(err error) {
	if _, ok := err.(CommandLineError); ok {
		fmt.Fprintf(os.Stderr, "Bad command line: %s.\n\n", err)
		c.Flags.Usage()
	} else {
		os.Stderr.WriteString(strings.Join(CollectErrorMessages(err, nil), "\n"))
		os.Stderr.WriteString("\n")
	}
}