// NewErrCorrupted creates new ErrCorrupted error.
509021
func NewErrCorrupted(fd storage.FileDesc, err error) error {
	return &ErrCorrupted{fd, err}
}
786165
func (ec ErrClass) New(code ErrCode, message string) *Error {
	return &Error{
		class:   ec,
		code:    code,
		message: message,
	}
}
907418
func NewError(source, title,path,description string) *Error {
	return &Error {
		SourceType:source,
		Title:title,
		Path:path,
		Description:description,
	}
}
327994
func NewErrorSuppress(Expression node.Node) *ErrorSuppress {
	return &ErrorSuppress{
		FreeFloating: nil,
		Expr:         Expression,
	}
}
449876
func NewWriteCloserOnError(w io.WriteCloser, notify func(error)) io.WriteCloser {
	return NewWriteCloser(NewWriterOnError(w, notify), w)
}
1292818
func NewErrorObjectNotFound(e error, o string) ErrorObjectNotFound {
	return ErrorObjectNotFound{err: e, obj: o}
}
60631
func NewErr(r *http.Response) error {
	if r.StatusCode >= http.StatusOK && r.StatusCode < http.StatusMultipleChoices {
		return nil
	}

	switch r.StatusCode {
	case http.StatusUnauthorized:
		return transport.ErrAuthenticationRequired
	case http.StatusForbidden:
		return transport.ErrAuthorizationFailed
	case http.StatusNotFound:
		return transport.ErrRepositoryNotFound
	}

	return plumbing.NewUnexpectedError(&Err{r})
}
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)
	}
}
72490
func NewFileDownloadType(Description string) *FileDownloadType {
	s := new(FileDownloadType)
	s.Description = Description
	return s
}
1009267
func newErrNoDescriber(types ...reflect.Type) error {
	names := make([]string, 0, len(types))
	for _, t := range types {
		names = append(names, t.String())
	}
	return describe.ErrNoDescriber{Types: names}
}
1069628
func NewErrorManager(render abcrender.Renderer) *errorManager {
	return &errorManager{
		render: render,
		errors: []ErrorContainer{},
	}
}
325384
func (c *Client) NewRenewer(i *RenewerInput) (*Renewer, error) {
	if i == nil {
		return nil, ErrRenewerMissingInput
	}

	secret := i.Secret
	if secret == nil {
		return nil, ErrRenewerMissingSecret
	}

	random := i.Rand
	if random == nil {
		random = rand.New(rand.NewSource(int64(time.Now().Nanosecond())))
	}

	renewBuffer := i.RenewBuffer
	if renewBuffer == 0 {
		renewBuffer = DefaultRenewerRenewBuffer
	}

	return &Renewer{
		client:    c,
		secret:    secret,
		increment: i.Increment,
		random:    random,
		doneCh:    make(chan error, 1),
		renewCh:   make(chan *RenewOutput, renewBuffer),

		stopped: false,
		stopCh:  make(chan struct{}),
	}, nil
}
865987
func NewRFCError(code Code, err error, version string) (*rfc2119.Error, error) {
	template := ociErrors[code]
	reference, err2 := template.Reference(version)
	if err2 != nil {
		return nil, err2
	}
	return &rfc2119.Error{
		Level:     template.Level,
		Reference: reference,
		Err:       err,
	}, nil
}
718543
func NewErrCountFS(fs FS, name string, err error) *ErrCountFS {
	status := expvar.NewMap(name)
	status.Set("open.total", new(expvar.Int))
	status.Set("open.count", new(expvar.Int))

	status.Set("create.total", new(expvar.Int))
	status.Set("create.count", new(expvar.Int))

	status.Set("delete.total", new(expvar.Int))
	status.Set("delete.count", new(expvar.Int))

	return &ErrCountFS{
		fs:     fs,
		status: status,
		err:    err,
	}
}
786991
func isRetryNeeded(err error, fn string, key string, retryCount int) (bool, error) {
	switch err {
	case kvdb.ErrNotSupported, kvdb.ErrWatchStopped, kvdb.ErrNotFound, kvdb.ErrExist, kvdb.ErrUnmarshal, kvdb.ErrValueMismatch, kvdb.ErrModified:
		// For all known kvdb errors no retry is needed
		return false, err
	case rpctypes.ErrGRPCEmptyKey:
		return false, kvdb.ErrNotFound
	default:
		// For all other errors retry
		logrus.Errorf("[%v: %v] kvdb error: %v, retry count %v \n", fn, key, err, retryCount)
		return true, err
	}
}
904307
func NewRelaxed(t T) *I {
	return &I{t, t.Fail, os.Stdout, !noColorFlag}
}
502242
func IsErrNotImplemented(err error) bool {
	if _, ok := err.(notImplementedError); ok {
		return ok
	}
	return errdefs.IsNotImplemented(err)
}