// New returns an error message in proper JSON format
555586
func New(writer http.ResponseWriter, httpStatus int, message string) {
	response := &response{
		Response: message,
	}

	jsonResponse, err := json.Marshal(response)
	if err != nil {
		http.Error(writer, err.Error(), http.StatusInternalServerError)
	}

	writer.Header().Set("Content-Type", "application/json")
	writer.WriteHeader(httpStatus)
	writer.Write(jsonResponse)
}
322838
func New(errMsg string) *Error {
	if NewLine {
		errMsg += "\n"
	}
	return &Error{message: Prefix + errMsg}
}
203961
func New(next http.Handler, setters ...optSetter) (*Buffer, error) {
	strm := &Buffer{
		next: next,

		maxRequestBodyBytes: DefaultMaxBodyBytes,
		memRequestBodyBytes: DefaultMemBodyBytes,

		maxResponseBodyBytes: DefaultMaxBodyBytes,
		memResponseBodyBytes: DefaultMemBodyBytes,

		log: log.StandardLogger(),
	}
	for _, s := range setters {
		if err := s(strm); err != nil {
			return nil, err
		}
	}
	if strm.errHandler == nil {
		strm.errHandler = errHandler
	}

	return strm, nil
}
87132
func (api *GSLBAPI) New(name string) *sacloud.GSLB {
	return sacloud.CreateNewGSLB(name)
}
493321
func New(e error, fields ...map[string]interface{}) *snapError {
	// Catch someone trying to wrap a serror around a serror.
	// We throw a panic to make them fix this.
	if _, ok := e.(SnapError); ok {
		panic("You are trying to wrap a snapError around a snapError. Don't do this.")
	}

	p := &snapError{
		err:    e,
		fields: make(map[string]interface{}),
	}

	// insert fields into new snapError
	for _, f := range fields {
		for k, v := range f {
			p.fields[k] = v
		}
	}

	return p
}
208687
func (s *Scheme) New(versionName, typeName string) (Object, error) {
	obj, err := s.raw.NewObject(versionName, typeName)
	if err != nil {
		return nil, err
	}
	return obj.(Object), nil
}
1120212
func New() *Document {
	json := &Document{}
	if IncludeJSONAPIVersion {
		json.JSONAPI = &JSONAPI{
			Version: JSONAPIVersion,
		}
	}

	return json
}
9759
func New(server *osin.Server, service ServiceInterface) *rest {
	return &rest{server, service}
}
926578
func New(message string, keyValues ...interface{}) error {
	len := len(keyValues)
	if len == 0 {
		return errors.New(message)
	}
	buffer := bytes.NewBuffer(nil)
	if message != "" {
		_, _ = buffer.WriteString(message)
		_ = buffer.WriteByte(' ')
	}
	if len%2 != 0 {
		keyValues = append(keyValues, "MISSING")
		len++
	}
	for i := 0; i < len; i += 2 {
		if i != 0 {
			_ = buffer.WriteByte(' ')
		}
		_, _ = buffer.WriteString(fmt.Sprintf("%v", keyValues[i]))
		_ = buffer.WriteByte('=')
		_, _ = buffer.WriteString(fmt.Sprintf("%v", keyValues[i+1]))
	}
	return errors.New(buffer.String())
}
630794
func New(auth Auth) (*Client, error) {
	if err := auth.validate(); err != nil {
		return nil, err
	}

	return &Client{
		c:        &http.Client{},
		username: auth.Username,
		apiKey:   auth.Apikey,
	}, nil
}
321899
func New(errType ErrorType, msg string, args ...interface{}) error {
	return &BoulderError{
		Type:   errType,
		Detail: fmt.Sprintf(msg, args...),
	}
}
944368
func NewError(statuscode int, msg string) *Error {
	return &Error{StatusCode: statuscode, Message: msg}
}
300738
func New(jsonPointerString string) (Pointer, error) {

	var p Pointer
	err := p.parse(jsonPointerString)
	return p, err

}
998689
func (c *ChallengeService) New(chlgURL string) (acme.ExtendedChallenge, error) {
	if len(chlgURL) == 0 {
		return acme.ExtendedChallenge{}, errors.New("challenge[new]: empty URL")
	}

	// Challenge initiation is done by sending a JWS payload containing the trivial JSON object `{}`.
	// We use an empty struct instance as the postJSON payload here to achieve this result.
	var chlng acme.ExtendedChallenge
	resp, err := c.core.post(chlgURL, struct{}{}, &chlng)
	if err != nil {
		return acme.ExtendedChallenge{}, err
	}

	chlng.AuthorizationURL = getLink(resp.Header, "up")
	chlng.RetryAfter = getRetryAfter(resp)
	return chlng, nil
}
242946
func New(code string, message string) error {
	err := errors.New(message)
	return argoerr{code, message, err.(stackTracer)}
}
960391
func New(ctx context.Context, err error, skip int) *Error {
	if e, ok := err.(*Error); ok {
		return e
	}
	return new(err, skip+1).WithContext(ctx)
}
1039247
func New(data []byte) (*JSONSchema, error) {
	j := JSONSchema{}
	err := json.Unmarshal(data, &j.rawSchema)
	if err != nil {
		return nil, trace.Wrap(err)
	}

	loader := gojsonschema.NewGoLoader(j.rawSchema)
	j.schema, err = gojsonschema.NewSchema(loader)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return &j, nil
}