// NewConflictError returns an error including details on the requests apply conflicts
513622
func NewConflictError(conflicts merge.Conflicts) *errors.StatusError {
	causes := []metav1.StatusCause{}
	for _, conflict := range conflicts {
		causes = append(causes, metav1.StatusCause{
			Type:    metav1.CauseTypeFieldManagerConflict,
			Message: fmt.Sprintf("conflict with %v", printManager(conflict.Manager)),
			Field:   conflict.Path.String(),
		})
	}
	return errors.NewApplyConflict(causes, getConflictMessage(conflicts))
}
253807
func newAPIError(code int32, detail string) api.Error {
	codeEnum := api.ErrorCode(code)
	_, ok := api.ErrorCode_name[code]
	if !ok {
		if code >= 400 && code < 499 {
			code = int32(api.ErrorCode_bad_request)
		} else {
			code = int32(api.ErrorCode_internal_server_error)
		}
		codeEnum = api.ErrorCode(code)
	}
	return api.Error{
		Code:   &code,
		Title:  codeEnum.Enum(),
		Detail: &detail,
	}
}
106587
func NewErrorResponder(err error) Responder {
	return func(req *http.Request) (*http.Response, error) {
		return nil, err
	}
}
456742
func NewWarning(message string) *kerrors.StatusError {
	return &kerrors.StatusError{ErrStatus: metav1.Status{
		Status:  metav1.StatusSuccess,
		Code:    http.StatusOK,
		Message: message,
	}}
}
777544
func (r *BulkIndexRequest) RetryOnConflict(retryOnConflict int) *BulkIndexRequest {
	r.retryOnConflict = &retryOnConflict
	r.source = nil
	return r
}
842421
func NewJiraError(resp *Response, httpError error) error {
	if resp == nil {
		return errors.Wrap(httpError, "No response returned")
	}

	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return errors.Wrap(err, httpError.Error())
	}
	jerr := Error{HTTPError: httpError}
	contentType := resp.Header.Get("Content-Type")
	if strings.HasPrefix(contentType, "application/json") {
		err = json.Unmarshal(body, &jerr)
		if err != nil {
			httpError = errors.Wrap(errors.New("Could not parse JSON"), httpError.Error())
			return errors.Wrap(err, httpError.Error())
		}
	} else {
        if httpError == nil {
            return fmt.Errorf("Got Response Status %s:%s", resp.Status, string(body))
        }
		return errors.Wrap(httpError, fmt.Sprintf("%s: %s", resp.Status, string(body)))
	}

	return &jerr
}
898900
func NewValidationError(err string, warnings ...string) ValidateResponseModel {
	return ValidateResponseModel{
		Error:    err,
		Warnings: warnings,
	}
}
217937
func newError(message string) *Error {
	switch {
	case strings.HasPrefix(message, "rpc: service/method request ill-formed"):
		return NewError(errMethod.Code, message)
	case strings.HasPrefix(message, "rpc: can't find service"):
		return NewError(errMethod.Code, message)
	case strings.HasPrefix(message, "rpc: can't find method"):
		return NewError(errMethod.Code, message)
	default:
		return NewError(errServer.Code, message)
	}
}
126331
func NewError(code int, s string) error {
	if code < 0 || code >= ErrCnt {
		panic("no such error code!")
	}
	r := &Error{
		err: s,
	}
	switch code {
	case ErrNotFound, ErrIO, ErrUnauthorized, ErrInvalidValue, ErrDataOverflow, ErrNothingToReturn, ErrInvalidSignature, ErrNotSynced, ErrPeriodDepth, ErrCorruptData:
		r.code = code
	}
	return r
}
282410
func (gco *GCOp) checkConflict(
	ctx context.Context, renamer ConflictRenamer, mergedOp op,
	isFile bool) (crAction, error) {
	return nil, nil
}
1231526
func (s *Serf) handleNodeConflict(existing, other *memberlist.Node) {
	// Log a basic warning if the node is not us...
	if existing.Name != s.config.NodeName {
		s.logger.Printf("[WARN] serf: Name conflict for '%s' both %s:%d and %s:%d are claiming",
			existing.Name, existing.Addr, existing.Port, other.Addr, other.Port)
		return
	}

	// The current node is conflicting! This is an error
	s.logger.Printf("[ERR] serf: Node name conflicts with another node at %s:%d. Names must be unique! (Resolution enabled: %v)",
		other.Addr, other.Port, s.config.EnableNameConflictResolution)

	// If automatic resolution is enabled, kick off the resolution
	if s.config.EnableNameConflictResolution {
		go s.resolveNodeConflict()
	}
}
1161259
func NewRequestError(req *http.Request, code int32, detail string) error {
	return &Error{
		silent:   false,
		redirect: false,
		source:   req.URL.String(),
		request:  req,
		err:      newAPIError(code, detail),
	}
}
1167265
func NewInvalidError(field *FieldPath, value interface{}, detail string) *Error {
	return &Error{ErrorTypeInvalid, field.String(), value, detail}
}
664610
func NewHTTPError(code int, message ...string) (err *HTTPError) {

	err = &HTTPError{code: code}

	switch len(message) {
	case 1:
		err.message = message[0]
	case 0:
		err.message = http.StatusText(code)
	}

	return err

}
840806
func NewHTTPError(err error, status int) HTTPError {

	var innerErr *goof
	switch tErr := err.(type) {
	case nil:
		return &httpError{
			withFieldsE(Fields{
				"status": status,
			}, fmt.Sprintf("%d", status), nil),
		}
	case *goof:
		innerErr = tErr
	case Goof:
		innerErr = withFieldsE(tErr.Fields(), tErr.Error(), nil)
	default:
		innerErr = withFieldsE(nil, tErr.Error(), nil)
	}

	innerErr.IncludeMessageInJSON(false)

	return &httpError{
		withFieldsE(Fields{"status": status}, innerErr.Error(), innerErr),
	}
}
642580
func NewRequestFailure(err Error, statusCode int, reqID string) RequestFailure {
	return newRequestError(err, statusCode, reqID)
}
561327
func NewError(cause error, msg string) error {
	if cause != nil {
		return &pcError{
			ErrorNode: ErrorNode{}.Initialize(cause, 3),
			msg:       msg,
		}
	}
	return &pcErrorNoCause{
		ErrorNodeNoCause: ErrorNodeNoCause{}.Initialize(3),
		msg:              msg,
	}
}