// NewErrorEvent creates an EventRequest for reporting errors.
774273
func NewErrorEvent(e ExitCode) *omaha.EventRequest {
	return &omaha.EventRequest{
		Type:      omaha.EventTypeUpdateComplete,
		Result:    omaha.EventResultError,
		ErrorCode: int(e),
	}
}
81463
func (em *EventManager) NewEvent(evtype, evselector string) (EventSubs, bool) {
	eo := BuildEventID(evtype, evselector)

	if em.HasEvent(eo) {
		ed, _ := em.GetEvent(eo)
		return ed, false
	}

	emo := NewEventSub(evtype, evselector)

	em.AddEvent(emo)
	return emo, true
}
258859
func NewError(code string, loc *Location, f string, a ...interface{}) *Error {
	return &Error{
		Code:     code,
		Location: loc,
		Message:  fmt.Sprintf(f, a...),
	}
}
990938
func (EventReceiver) SpanError(ctx context.Context, err error) {
	if span := ot.SpanFromContext(ctx); span != nil {
		otext.Error.Set(span, true)
		span.LogFields(otlog.String("event", "error"), otlog.Error(err))
	}
}
1029236
func NewError(msg string, r io.Reader, offset int) *Error {
	return &Error{
		Message: msg,
		r:       r,
		Offset:  offset,
	}
}
989792
func NewError(line, column int, err string) *Error {
	return &Error{
		Line:   line,
		Column: column,
		Err:    err,
	}
}
315537
func (f EventHandlerFunc) HandleEvent(resp http.ResponseWriter, req *http.Request, event *Event) {
	f(resp, req, event)
}
81135
func NewError(code ErrorCode, str string, fatal bool) (err Error) {
	return Error{code, str, fatal}
}
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,
	}
}
126820
func NewError(code int, msg ...string) *Error {
	e := &errors.CodedError{
		Code: int32(code),
	}
	switch len(msg) {
	case 0:
		e.Message = http.StatusText(code)
	case 1:
		e.Message = msg[0]
	case 2:
		e.Message = msg[0]
		e.Detail = msg[1]
	}
	return (*Error)(e)
}
617732
func (s *DirectMessageService) EventsNew(params *DirectMessageEventsNewParams) (*DirectMessageEvent, *http.Response, error) {
	// Twitter API wraps the event response
	wrap := &struct {
		Event *DirectMessageEvent `json:"event"`
	}{}
	apiError := new(APIError)
	resp, err := s.sling.New().Post("events/new.json").BodyJSON(params).Receive(wrap, apiError)
	return wrap.Event, resp, relevantError(err, *apiError)
}
239324
func NewErrorf(code int, format string, args ...interface{}) error {
	return NewError(code, fmt.Sprintf(format, args...))
}
257904
func newErrorBox(err error, code int, msgs Messages, args ...interface{}) *errorBox {
	return &errorBox{
		err:  err,
		code: code,
		msg:  msgs.Format(code, args...),
		info: retrieveCallInfo(),
	}
}
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
}
199144
func NewError(ctx *gin.Context, status int, err error) {
	er := HTTPError{
		Code:    status,
		Message: err.Error(),
	}
	ctx.JSON(status, er)
}
594325
func NewError(errcode C.int) error {
	if errcode == C.MPV_ERROR_SUCCESS {
		return nil
	}
	return Error(errcode)
}
1355360
func newEvents(c *Client, ns string) *events {
	return &events{
		client:    c,
		namespace: ns,
	}
}