// ReturnsError is deprecated, use Returns instead.
187672
func (b *RouteBuilder) ReturnsError(code int, message string, model interface{}) *RouteBuilder {
	log.Print("ReturnsError is deprecated, use Returns instead.")
	return b.Returns(code, message, model)
}
1324959
func (err *Error) Error() string {
	return fmt.Sprintf("%s\nRefer to: %s", err.Err.Error(), err.Reference)
}
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, ", ")
}
806484
func (e *ResponseError) Error() string {
	return fmt.Sprintf("%v %v: %d - %s",
		e.Response.Request.Method, e.Response.Request.URL,
		e.Response.StatusCode, e.errorMessage())
}
1069198
func getAPIError(code APIErrorCode) APIError {
	if apiErr, ok := errorCodes[code]; ok {
		return apiErr
	}
	return errorCodes.ToAPIErr(ErrInternalError)
}
426432
func (e ServerError) Error() string {
	if e.Err != nil {
		return e.Err.Error()
	}
	return "ServerError"
}
523223
func Return(w http.ResponseWriter, code int, data interface{}) {
	w.WriteHeader(code)
	switch data.(type) {
	case string:
		w.Write([]byte(data.(string)))
	case []byte:
		w.Write(data.([]byte))
	}
}
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
}
474064
func (f *file) lintErrorReturn() {
	f.walk(func(n ast.Node) bool {
		fn, ok := n.(*ast.FuncDecl)
		if !ok || fn.Type.Results == nil {
			return true
		}
		ret := fn.Type.Results.List
		if len(ret) <= 1 {
			return true
		}
		if isIdent(ret[len(ret)-1].Type, "error") {
			return true
		}
		// An error return parameter should be the last parameter.
		// Flag any error parameters found before the last.
		for _, r := range ret[:len(ret)-1] {
			if isIdent(r.Type, "error") {
				f.errorf(fn, 0.9, category("arg-order"), "error should be the last type when returning multiple items")
				break // only flag one
			}
		}
		return true
	})
}
912915
func deriveToError(err error, f func(vers string) (major int, minor int, ok bool)) func(vers string) (int, int, error) {
	return func(vers string) (int, int, error) {
		out0, out1, success := f(vers)
		if success {
			return out0, out1, nil
		}
		return out0, out1, err
	}
}
904088
func (err *ErrSession) Error() string {
	if err.Err == nil {
		return fmt.Sprintf("%s (%s)", stateTexts[err.State], err.Type)
	}
	return fmt.Sprintf("%s: %s (%s)", stateTexts[err.State], err.Err, err.Type)
}
268507
func (defaultErrorHandler) HandleError(err error, w http.ResponseWriter, req *http.Request) {
	w.WriteHeader(http.StatusInternalServerError)
	fmt.Fprintf(w, "Error: %s", err)
}
950267
func (e *Error) Error() string {
	if len(e.Stderr) == 0 {
		return e.ExitError.Error()
	}
	n := bytes.IndexByte(e.Stderr, '\n')
	if n < 0 {
		return string(e.Stderr)
	}
	return string(e.Stderr[:n])
}
1244552
func RestoreError(err error) error {
	err = errors.Cause(err)

	if apiErr, ok := err.(*params.Error); !ok {
		return err
	} else if apiErr == nil {
		return nil
	}
	if params.ErrCode(err) == "" {
		return err
	}
	msg := err.Error()

	if singleton, ok := singletonError(err); ok {
		return singleton
	}

	// TODO(ericsnow) Support the other error types handled by ServerError().
	switch {
	case params.IsCodeUnauthorized(err):
		return errors.NewUnauthorized(nil, msg)
	case params.IsCodeNotFound(err):
		// TODO(ericsnow) UnknownModelError should be handled here too.
		// ...by parsing msg?
		return errors.NewNotFound(nil, msg)
	case params.IsCodeUserNotFound(err):
		return errors.NewUserNotFound(nil, msg)
	case params.IsCodeAlreadyExists(err):
		return errors.NewAlreadyExists(nil, msg)
	case params.IsCodeNotAssigned(err):
		return errors.NewNotAssigned(nil, msg)
	case params.IsCodeHasAssignedUnits(err):
		// TODO(ericsnow) Handle state.HasAssignedUnitsError here.
		// ...by parsing msg?
		return err
	case params.IsCodeHasHostedModels(err):
		return err
	case params.IsCodeHasPersistentStorage(err):
		return err
	case params.IsCodeModelNotEmpty(err):
		return err
	case params.IsCodeNoAddressSet(err):
		// TODO(ericsnow) Handle isNoAddressSetError here.
		// ...by parsing msg?
		return err
	case params.IsCodeNotProvisioned(err):
		return errors.NewNotProvisioned(nil, msg)
	case params.IsCodeUpgradeInProgress(err):
		// TODO(ericsnow) Handle state.UpgradeInProgressError here.
		// ...by parsing msg?
		return err
	case params.IsCodeMachineHasAttachedStorage(err):
		// TODO(ericsnow) Handle state.HasAttachmentsError here.
		// ...by parsing msg?
		return err
	case params.IsCodeStorageAttached(err):
		return err
	case params.IsCodeNotSupported(err):
		return errors.NewNotSupported(nil, msg)
	case params.IsBadRequest(err):
		return errors.NewBadRequest(nil, msg)
	case params.IsMethodNotAllowed(err):
		return errors.NewMethodNotAllowed(nil, msg)
	case params.ErrCode(err) == params.CodeDischargeRequired:
		// TODO(ericsnow) Handle DischargeRequiredError here.
		return err
	default:
		return err
	}
}
47900
func IsRetryError(e error) bool {
	type ad interface {
		IsRetryError() bool
	}
	_, ok := Unwrap(e).(ad)
	return ok
}
921240
func (e *Err) Error() string {
	if e.InnerError != nil {
		return e.InnerError.Error()
	}
	return e.Message
}
418616
func (me *Dataset) Returning(returning ...interface{}) *Dataset {
	ret := me.copy()
	ret.clauses.Returning = cols(returning...)
	return ret
}