// NewError returns a new Error instance for the given error e and position p.
544427
func NewError(e error, p Position) Error {
	return &err{error: e, _position: p}
}
868062
func NewValidationError(errorText string, errorFlags uint32) *ValidationError {
	return &ValidationError{
		text:   errorText,
		Errors: errorFlags,
	}
}
1292818
func NewErrorObjectNotFound(e error, o string) ErrorObjectNotFound {
	return ErrorObjectNotFound{err: e, obj: o}
}
338049
func NewMultiError(errs ...error) *MultiError {
	return &MultiError{errs[:len(errs)-1], errs[len(errs)-1]}
}
278050
func NewApiError(code int, msg string) *Error {
	return &Error{
		apiError: &apiError{
			code: code,
			msg:  msg,
		},
		Err: nil,
	}
}
1317562
func NewError(errorType ErrorType, err error) Error {
	return Error{errorType: errorType, source: err}
}
275678
func NewError(context *Context, message string) *Error {
	return &Error{Context: context, Message: message}
}
1240026
func newErrf(code errorCode, format string, a ...interface{}) *routerError {
	return &routerError{
		code: code,
		err:  errors.Errorf(format, a...),
	}
}
594325
func NewError(errcode C.int) error {
	if errcode == C.MPV_ERROR_SUCCESS {
		return nil
	}
	return Error(errcode)
}
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
}
612887
func newError(message string, err error) *Error {
	return &Error{
		Message:      message,
		DetailsError: err,
	}
}
464246
func newCrawlError(ctx *URLContext, e error, kind CrawlErrorKind) *CrawlError {
	return &CrawlError{ctx, e, kind, ""}
}
452778
func NewErrorTypeMatcher(t ErrorType) utilerrors.Matcher {
	return func(err error) bool {
		if e, ok := err.(*Error); ok {
			return e.Type == t
		}
		return false
	}
}
1121384
func MayError(code uint, err error) Error {
	if err == nil {
		return nil
	}
	return NewError(code, err)
}
786165
func (ec ErrClass) New(code ErrCode, message string) *Error {
	return &Error{
		class:   ec,
		code:    code,
		message: message,
	}
}
215024
func NewEventError(err error) *EventError {
	return &EventError{t: time.Now(), err: err}
}
561701
func NewRPCError(code RPCErrorCode, message string) *RPCError {
	return &RPCError{
		Code:    code,
		Message: message,
	}
}