// Wrap returns an error annotating err with message.
// If err is nil, Wrap returns nil.
164402
func Wrap(err error, message string) error {
	return errs.Wrap(err, message)
}
1353619
func Wrap(err error, message string) error {
	if err == nil {
		return nil
	}
	err = &withMessage{
		cause: err,
		msg:   message,
	}
	return &withStack{
		err,
		callers(),
	}
}
922754
func (retry *RetryRequest) Wrap(innerconnection uaa.Connection) uaa.Connection {
	retry.connection = innerconnection
	return retry
}
1103717
func Wrap(handler http.Handler) Handler {
	return HandlerFunc(func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
		handler.ServeHTTP(rw, r)
		next(rw, r)
	})
}
1219149
func wrap(sl []byte) []byte {
	length := 0
	for i := 0; i < len(sl); i++ {
		if length > 76 && sl[i] == ' ' {
			sl = append(sl, 0, 0)
			copy(sl[i+2:], sl[i:])
			sl[i] = '\r'
			sl[i+1] = '\n'
			sl[i+2] = '\t'
			i += 2
			length = 0
		}
		if sl[i] == '\n' {
			length = 0
		}
		length++
	}
	return sl
}
757739
func (logger *RequestLogger) Wrap(innerconnection plugin.Connection) plugin.Connection {
	logger.connection = innerconnection
	return logger
}
450797
func Wrap(s string, w int) string {
	return DefaultCondition.Wrap(s, w)
}
195507
func Wrapf(err error, format string, a ...interface{}) error {
	if err == nil {
		return nil
	}
	return &wrapped{
		err: err,
		msg: fmt.Sprintf(format, a...),
	}
}
1072038
func (t *UAAAuthentication) Wrap(innerconnection uaa.Connection) uaa.Connection {
	t.connection = innerconnection
	return t
}
1352125
func Wrap(err error, message string) error {
	if err == nil {
		return nil
	}
	err = &withMessage{
		cause: err,
		msg:   message,
	}
	return &withStack{
		err,
		stack.New(1),
	}
}
497097
func wrapError(status uint16, err error) error {
	return &Error{status, err.Error(), err}
}
201175
func Wrap(task string, err error) Err {
	if err == nil {
		return nil
	}

	return NewError(task, err)
}
773731
func Wrap(err error, message string) error {
	return &error2{
		Inner:    err,
		Location: locate(2),
		Message:  message,
	}
}
1268103
func Wrap(w DoerAt, p []byte, off int64, wrapAt int64) (n int, err error) {
	var m, fails int

	off %= wrapAt

	for len(p) > 0 {

		if off+int64(len(p)) < wrapAt {
			m, err = w.DoAt(p, off)
		} else {
			space := wrapAt - off
			m, err = w.DoAt(p[:space], off)
		}

		if err != nil && err != io.EOF {
			return n + m, err
		}

		switch m {
		case 0:
			fails++
		default:
			fails = 0
		}

		if fails > maxConsecutiveEmptyActions {
			return n + m, io.ErrNoProgress
		}

		n += m
		p = p[m:]
		off += int64(m)
		off %= wrapAt
	}

	return n, err
}
1220064
func Wrap(err error, text string) error {
	return Error(strings.Join([]string{text, err.Error()}, "-> "))
}
1229934
func (hp *HTTPParams) Wrap(h http.Handler) http.Handler {
	csrf := New(hp.Key)
	csrf.MaxAge = 3 * time.Hour

	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		token := headerOrCookieValue(r, hp.CSRFHeader, hp.CSRFCookie)
		id := headerOrCookieValue(r, hp.SessionHeader, hp.SessionCookie)

		var valid bool

		if token != "" && id != "" {
			err := csrf.Validate(id, token)
			if err == nil {
				valid = true
			} else if err != ErrInvalidToken {
				// This should never occur
				panic(err)
			}
		}

		if valid {
			h.ServeHTTP(w, r)
		} else if hp.InvalidHandler != nil {
			hp.InvalidHandler.ServeHTTP(w, r)
		} else {
			log.Printf("Rejected request with an invalid CSRF token=%q for session=%q. (event=csrf_invalid)",
				token, id)
			w.WriteHeader(http.StatusForbidden)
		}
	})
}
598642
func Wrap(w Wrapper) Option {
	return func(o *Options) {
		o.Wrappers = append(o.Wrappers, w)
	}
}