// NewErr generates a SQL error, with an error code and default format specifier defined in MySQLErrName.
512141
func NewErr(errCode uint16, args ...interface{}) *SQLError {
	e := &SQLError{Code: errCode}

	if s, ok := MySQLState[errCode]; ok {
		e.State = s
	} else {
		e.State = DefaultMySQLState
	}

	if format, ok := MySQLErrName[errCode]; ok {
		e.Message = fmt.Sprintf(format, args...)
	} else {
		e.Message = fmt.Sprint(args...)
	}

	return e
}
775553
func NewNotRegisteredErr(gvk unversioned.GroupVersionKind, t reflect.Type) error {
	return &notRegisteredErr{gvk: gvk, t: t}
}
827708
func newError(err error, msg string) *Error {
	return &Error{
		Message: msg,
		Err:     err,
	}
}
920579
func NewError(options ...func(*Error)) *Error {
	err := &Error{}
	for _, o := range options {
		o(err)
	}

	return err
}
959022
func NewLRN(lrnN uint, lrnAlpha float64, lrnBeta float64, lrnK float64) (retVal *LRN, err error) {
	var internal C.cudnnLRNDescriptor_t
	if err := result(C.cudnnCreateLRNDescriptor(&internal)); err != nil {
		return nil, err
	}

	if err := result(C.cudnnSetLRNDescriptor(internal, C.uint(lrnN), C.double(lrnAlpha), C.double(lrnBeta), C.double(lrnK))); err != nil {
		return nil, err
	}

	retVal = &LRN{
		internal: internal,
		lrnN:     lrnN,
		lrnAlpha: lrnAlpha,
		lrnBeta:  lrnBeta,
		lrnK:     lrnK,
	}
	runtime.SetFinalizer(retVal, destroyLRN)
	return retVal, nil
}
148501
func newError(status uint16) error {
	switch status {
	case StatusOK:
		return nil
	case StatusNotFound:
		return ErrNotFound
	case StatusKeyExists:
		return ErrKeyExists
	case StatusValueTooLarge:
		return ErrValueTooLarge
	case StatusInvalidArgs:
		return ErrInvalidArgs
	case StatusValueNotStored:
		return ErrValueNotStored
	case StatusNonNumeric:
		return ErrNonNumeric
	case StatusAuthRequired:
		return ErrAuthRequired

	// we only support PLAIN auth, no mechanism that would make use of auth
	// continue, so make it an error for now for completeness.
	case StatusAuthContinue:
		return ErrAuthContinue
	case StatusUnknownCommand:
		return ErrUnknownCommand
	case StatusOutOfMemory:
		return ErrOutOfMemory
	}
	return ErrUnknownError
}
81135
func NewError(code ErrorCode, str string, fatal bool) (err Error) {
	return Error{code, str, fatal}
}
452778
func NewErrorTypeMatcher(t ErrorType) utilerrors.Matcher {
	return func(err error) bool {
		if e, ok := err.(*Error); ok {
			return e.Type == t
		}
		return false
	}
}
785872
func NewError(err error) *Error {
	e := &Error{}
	if err != nil {
		e.Store(err)
	}
	return e
}
545571
func NewError(code ErrorCode, node string) error {
	var message string
	switch code {
	case NodeExists:
		message = fmt.Sprintf("node already exists: %s", node)
	case NoNode:
		message = fmt.Sprintf("node doesn't exist: %s", node)
	case NodeNotEmpty:
		message = fmt.Sprintf("node not empty: %s", node)
	case Timeout:
		message = fmt.Sprintf("deadline exceeded: %s", node)
	case Interrupted:
		message = fmt.Sprintf("interrupted: %s", node)
	case BadVersion:
		message = fmt.Sprintf("bad node version: %s", node)
	case PartialResult:
		message = fmt.Sprintf("partial result: %s", node)
	case NoUpdateNeeded:
		message = fmt.Sprintf("no update needed: %s", node)
	case NoImplementation:
		message = fmt.Sprintf("no such topology implementation %s", node)
	default:
		message = fmt.Sprintf("unknown code: %s", node)
	}
	return Error{
		code:    code,
		message: message,
	}
}
1268779
func NewError(format string, args ...interface{}) Error {
	err := FmtError{format, args}
	return newCmnError(err)
}
904213
func NewClientErr(parent error, code string, description string) *ClientErr {
	return &ClientErr{parent, code, description}
}
594325
func NewError(errcode C.int) error {
	if errcode == C.MPV_ERROR_SUCCESS {
		return nil
	}
	return Error(errcode)
}
215024
func NewEventError(err error) *EventError {
	return &EventError{t: time.Now(), err: err}
}
1235447
func NewFromErr(err error) *Error {
	if err == nil {
		return nil
	}

	errp := New(err.Error())
	return &errp
}
367488
func newError(StatusCode int, Text string) *Error {
	return &Error{
		StatusCode: StatusCode,
		Text:       Text,
	}
}
121189
func NewError(matches []string) *Error {
	e := &Error{Msg: Decode(matches[2])}

	var err error
	if e.ID, err = strconv.Atoi(matches[1]); err != nil {
		// This should be impossible given it matched \d+ in the regexp.
		e.ID = -1
	}

	if rem := strings.TrimSpace(matches[3]); rem != "" {
		e.Details = make(map[string]interface{})
		for _, s := range strings.Split(rem, " ") {
			d := strings.SplitN(s, "=", 2)
			v := Decode(d[0])
			if i, err := strconv.Atoi(d[1]); err == nil {
				e.Details[v] = i
			} else {
				e.Details[v] = Decode(d[1])
			}
		}
	}

	return e
}