// This returns the error string without stack trace information.
499991
func GetMessage(err interface{}) string {
	switch e := err.(type) {
	case DropboxError:
		return extractFullErrorMessage(e, false)
	case runtime.Error:
		return runtime.Error(e).Error()
	case error:
		return e.Error()
	default:
		return "Passed a non-error to GetMessage"
	}
}
540613
func ErrorString(t testing.TB, expr interface{}, str string, args ...interface{}) {
	if IsNil(expr) { // 空值，必定没有错误
		assert(t, false, args, []interface{}{"ErrorString 失败，实际值为 Nil：[%T]", expr})
		return
	}

	if err, ok := expr.(error); ok {
		index := strings.Index(err.Error(), str)
		assert(t, index >= 0, args, []interface{}{"Error 失败，实际类型为[%T]", expr})
	}
}
1324959
func (err *Error) Error() string {
	return fmt.Sprintf("%s\nRefer to: %s", err.Err.Error(), err.Reference)
}
713413
func (e Error) Error() string {
	if e.Pos.Filename != "" || e.Pos.IsValid() {
		// don't print "<unknown position>"
		// TODO(gri) reconsider the semantics of Position.IsValid
		return e.Pos.String() + ": " + e.Msg
	}
	return e.Msg
}
1235543
func (m *MultiError) Error() string {
	m.mutex.Lock()
	defer m.mutex.Unlock()

	formattedError := make([]string, len(m.errs))
	for i, e := range m.errs {
		formattedError[i] = e.Error()
	}

	return strings.Join(formattedError, ", ")
}
1075232
func Stack(err error) error {
	return &stackError{
		cause: err,
		stack: string(debug.StackSkip(2)),
	}
}
735900
func Throw(text string) error {
	if atomic.LoadInt32(&enableTrace) != 0 {
		return traceError{stack: string(debug.Stack(2)) + "\n", text: text}
	}
	return traceError{text: text}
}
1057614
func (e *Error) Backtrace() string {
	if e.Stack == nil {
		return e.Msg
	}
	return e.Stack.String() + "Error: " + e.Msg
}
953734
func (err Error) Error() string {
	if err.Path != "" {
		return err.Path + ": " + err.Err.Error()
	}
	return err.Err.Error()
}
139927
func (e *ErrorObject) Error() string {
	return fmt.Sprintf("Error: %s %s\n", e.Title, e.Detail)
}
1055225
func (e *Error) Error() string {
	msg := fmt.Sprintf("%d: %s - %s", e.Status, e.Title, e.Detail)
	if e.Source.Pointer != "" {
		msg += fmt.Sprintf("(Source.Pointer: %s)", e.Source.Pointer)
	}

	if e.ISE != "" {
		msg += fmt.Sprintf("\nInternal Error: %s", e.ISE)
	}

	return msg
}
616936
func ErrorString(c web.C, rw http.ResponseWriter, code int, str string) {
	c.Env["err"] = str
	if code >= 500 {
		errStr := fmt.Sprintf("Internal Error (request ID: %s)", middleware.GetReqID(c))
		http.Error(rw, errStr, code)
	} else {
		http.Error(rw, str, code)
	}
}
909488
func Stacktrace(e error) string {
	s := Stack(e)
	if len(s) > 0 {
		buf := bytes.Buffer{}
		frames := runtime.CallersFrames(s)
		for {
			frame, more := frames.Next()
			buf.WriteString(frame.Function)
			buf.WriteString(fmt.Sprintf("\n\t%s:%d\n", frame.File, frame.Line))
			if !more {
				break
			}

		}
		return buf.String()
	}
	return ""
}
707879
func (r *NotInRule) Error(message string) *NotInRule {
	r.message = message
	return r
}
449235
func (v *Errors) Error() string {
	errs := []string{}
	for _, v := range v.Errors {
		errs = append(errs, v...)
	}
	return strings.Join(errs, "\n")
}
42158
func (e Error) Error() string {
	if e.error == nil {
		return "<nil>"
	}
	return e.error.Error()
}
501889
func (self Error) Error() string {
	filename := self.Position.Filename
	if filename == "" {
		filename = "(anonymous)"
	}
	return fmt.Sprintf("%s: Line %d:%d %s",
		filename,
		self.Position.Line,
		self.Position.Column,
		self.Message,
	)
}