// NewError creates an LDAP error with the given code and underlying error
978928
func NewError(resultCode uint8, err error) error {
	return &Error{ResultCode: resultCode, Err: err}
}
1222361
func NewErrorf(code uint, msg string, args ...interface{}) Error {
	return StandardError{code, PString(fmt.Sprintf(msg, args...))}
}
920579
func NewError(options ...func(*Error)) *Error {
	err := &Error{}
	for _, o := range options {
		o(err)
	}

	return err
}
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
}
987580
func NewErrorFile(fs *FS, entryValid *time.Duration) *SpecialReadFile {
	*entryValid = 0
	return &SpecialReadFile{read: libfs.GetEncodedErrors(fs.config)}
}
1172069
func NewErrorWithDescription(hr uintptr, description string) *OleError {
	return &OleError{hr: hr, description: description}
}
1017594
func Error(err error, code string, metadata ...map[string]string) *errors.Error {
	return errors.NewError(err, code, metadata...)
}
1117160
func NewErrorFromPanic(err interface{}) *Error {

	// Parse the filename and line from the originating line of app code.
	// /Users/robfig/code/gocode/src/revel/examples/booking/app/controllers/hotels.go:191 (0x44735)
	stack := string(debug.Stack())
	frame, basePath := findRelevantStackFrame(stack)
	if frame == -1 {
		return nil
	}

	stack = stack[frame:]
	stackElement := stack[:strings.Index(stack, "\n")]
	colonIndex := strings.LastIndex(stackElement, ":")
	filename := stackElement[:colonIndex]
	var line int
	fmt.Sscan(stackElement[colonIndex+1:], &line)

	// Show an error page.
	description := "Unspecified error"
	if err != nil {
		description = fmt.Sprint(err)
	}
	lines, readErr := ReadLines(filename)
	if readErr != nil {
		utilLog.Error("Unable to read file", "file", filename, "error", readErr)
	}
	return &Error{
		Title:       "Runtime Panic",
		Path:        filename[len(basePath):],
		Line:        line,
		Description: description,
		SourceLines: lines,
		Stack:       stack,
	}
}
72704
func New(text string, errs ...error) ErrorObject {
	if text != "" {
		errs = append([]error{errors.New(text)}, errs...)
	}
	return NewErrorsSkip(1, errs...)
}
373949
func NewError(packageType string, method string, message string, args ...interface{}) Error {
	return Error{
		PackageType: packageType,
		Method:      method,
		Message:     fmt.Sprintf(message, args...),
	}
}
868062
func NewValidationError(errorText string, errorFlags uint32) *ValidationError {
	return &ValidationError{
		text:   errorText,
		Errors: errorFlags,
	}
}
671157
func NewExitError(message interface{}, exitCode int) *ExitError {
	return &ExitError{
		exitCode: exitCode,
		message:  message,
	}
}
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),
	}
}
146899
func NewErrorMessage(errorCode, errorMessage string) []byte {
	return newErrorMessage([]byte(errorCode), []byte(errorMessage))
}
944368
func NewError(statuscode int, msg string) *Error {
	return &Error{StatusCode: statuscode, Message: msg}
}
863327
func NewError(code int, message string) ServiceError {
	return ServiceError{Code: code, Message: message}
}
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})
}