// ErrorString writes a response with specified status, code, and message set to
// the the err's string representation.
2504
func ErrorString(w http.ResponseWriter, status int, code string, err error) {
	Error(w, status, types.NewErrorV1(code, err.Error()))
}
594092
func (e ErrorResponse) Error() string {
	return fmt.Sprintf("API error %s %d (%s %d): %s", e.ErrorCode, e.ErrorCode, e.CSErrorCode, e.CSErrorCode, e.ErrorText)
}
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
}
168169
func (err MultiError) Error() string {
	switch len(err) {
	case 0:
		return "No error"
	case 1:
		return err[0].Error()
	default:
		var buf bytes.Buffer
		fmt.Fprintln(&buf, "Multiple errors:")
		for i, e := range err {
			if i > 0 {
				fmt.Fprintln(&buf)
			}
			fmt.Fprintf(&buf, "\t%v. %v", i+1, e)
		}
		return buf.String()
	}
}
841707
func errorString(ret C.nvmlReturn_t) error {
	if ret == C.NVML_SUCCESS {
		return nil
	}
	// We need to special case this because if nvml library is not found
	// nvmlErrorString() method will not work.
	if ret == C.NVML_ERROR_LIBRARY_NOT_FOUND || C.nvmlHandle == nil {
		return errLibraryNotLoaded
	}
	err := C.GoString(C.nvmlErrorString(ret))
	return fmt.Errorf("nvml: %v", err)
}
913701
func (t ErrorType) String() string {
	switch t {
	case ErrorTypeNotFound:
		return "Not found"
	case ErrorTypeRequired:
		return "Required value"
	case ErrorTypeDuplicate:
		return "Duplicate value"
	case ErrorTypeInvalid:
		return "Invalid value"
	case ErrorTypeNotSupported:
		return "Unsupported value"
	case ErrorTypeForbidden:
		return "Forbidden"
	case ErrorTypeTooLong:
		return "Too long"
	case ErrorTypeInternal:
		return "Internal error"
	default:
		panic(fmt.Sprintf("unrecognized validation error: %q", string(t)))
	}
}
1148023
func (c ErrorCode) String() string {
	switch c {
	case CodeOK:
		return "CodeOK"
	case CodeTemporaryFailure:
		return "CodeTemporaryFailure"
	case CodePermanentFailure:
		return "CodePermanentFailure"
	case CreateSessionCodeAlreadyExists:
		return "CreateSessionCodeAlreadyExists"
	case CreateSessionCodeRejectMaxUpdates:
		return "CreateSessionCodeRejectMaxUpdates"
	case CreateSessionCodeRejectRewardRate:
		return "CreateSessionCodeRejectRewardRate"
	case CreateSessionCodeRejectSweepFeeRate:
		return "CreateSessionCodeRejectSweepFeeRate"
	case CreateSessionCodeRejectBlobType:
		return "CreateSessionCodeRejectBlobType"
	case StateUpdateCodeClientBehind:
		return "StateUpdateCodeClientBehind"
	case StateUpdateCodeMaxUpdatesExceeded:
		return "StateUpdateCodeMaxUpdatesExceeded"
	case StateUpdateCodeSeqNumOutOfOrder:
		return "StateUpdateCodeSeqNumOutOfOrder"
	case DeleteSessionCodeNotFound:
		return "DeleteSessionCodeNotFound"
	default:
		return fmt.Sprintf("UnknownErrorCode: %d", c)
	}
}
676301
func (aer *AllErrorRecorder) ErrorStrings() []string {
	aer.mu.Lock()
	defer aer.mu.Unlock()
	if len(aer.Errors) == 0 {
		return nil
	}
	errs := make([]string, 0, len(aer.Errors))
	for _, e := range aer.Errors {
		errs = append(errs, e.Error())
	}
	return errs
}
42158
func (e Error) Error() string {
	if e.error == nil {
		return "<nil>"
	}
	return e.error.Error()
}
1211463
func (e Errors) Error() string {
	ret := ""
	if len(e) > 0 {
		ret = fmt.Sprintf("Errors:\n")
		ret += strings.Join(e, "\n")
	}
	return ret
}
128617
func (r *Result) Error() string {
	if r.Err != nil {
		return r.Err.Error()
	}

	return ""
}
953734
func (err Error) Error() string {
	if err.Path != "" {
		return err.Path + ": " + err.Err.Error()
	}
	return err.Err.Error()
}
443041
func WriteString(w http.ResponseWriter, s string) error {
	w.Header().Set("Content-Type", "text/plain; charset=utf-8")

	if _, err := io.WriteString(w, s); err != nil {
		return err
	}

	return nil
}
213325
func (e *Error) Error() string {
	var b strings.Builder

	// Print the current operation in our stack, if any.
	if e.Op != "" {
		fmt.Fprintf(&b, "%s: ", e.Op)
	}

	// If wrapping an error, print its Error() message.
	// Otherwise print the error code & message.
	if e.Err != nil {
		b.WriteString(e.Err.Error())
	} else {
		if e.Code != "" {
			fmt.Fprintf(&b, "<%s>", e.Code)
			if e.Msg != "" {
				b.WriteString(" ")
			}
		}
		b.WriteString(e.Msg)
	}
	return b.String()
}
530982
func (e *MultiError) Error() string {
	var m []string

	for _, err := range e.Errors {
		m = append(m, err.Error())
	}

	return strings.Join(m, ", ")
}
9810
func (ctx *Context) WriteString(content string) (int, error) {
	return io.WriteString(ctx.ResponseWriter, content)
}
372619
func (e Errors) Error() string {
	buf := bytes.NewBuffer(nil)
	buf.WriteString("[")
	for i, err := range e {
		if err == nil {
			buf.WriteString("<nil>")
		} else {
			buf.WriteString("<")
			buf.WriteString(err.Error())
			buf.WriteString(">")
		}
		if i < len(e)-1 {
			buf.WriteString(", ")
		}
	}
	buf.WriteString("]")
	return buf.String()
}