// WrapWithMessage wraps the original error into Error and adds user message if any
969934
func WrapWithMessage(err error, message interface{}, args ...interface{}) Error {
	trace := wrapWithDepth(err, 3)
	if trace != nil {
		trace.AddUserMessage(message, args...)
	}
	return trace
}
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),
	}
}
351687
func (client Client) CaptureMessage(message ...string) (string, error) {
	ev := Event{Message: strings.Join(message, " ")}
	sentryErr := client.Capture(&ev)

	if sentryErr != nil {
		return "", sentryErr
	}
	return ev.EventId, nil
}
1059192
func (lm *logMatcher) FailureMessage(actual interface{}) (message string) {
	return fmt.Sprintf(
		"Expected\n\t%s\nto contain log sequence \n\t%s",
		format.Object(lm.actual, 0),
		format.Object(lm.expected, 0),
	)
}
775094
func (c *Client) processMessage(data []byte) (msg *dnode.Message, fn interface{}, err error) {
	// Call error handler.
	defer func() {
		if err != nil {
			onError(err)
		}
	}()

	msg = &dnode.Message{}

	if err = json.Unmarshal(data, &msg); err != nil {
		return nil, nil, err
	}

	sender := func(id uint64, args []interface{}) error {
		// do not name the error variable to "err" here, it's a trap for
		// shadowing variables
		_, _, e := c.marshalAndSend(id, args)
		return e
	}

	// Replace function placeholders with real functions.
	if err := dnode.ParseCallbacks(msg, sender); err != nil {
		return nil, nil, err
	}

	// Find the handler function. Method may be string or integer.
	switch method := msg.Method.(type) {
	case float64:
		id := uint64(method)
		callback := c.scrubber.GetCallback(id)
		if callback == nil {
			err = dnode.CallbackNotFoundError{
				ID:   id,
				Args: msg.Arguments,
			}
			return nil, nil, err
		}

		return msg, callback, nil
	case string:
		m, ok := c.LocalKite.handlers[method]
		if !ok {
			err = dnode.MethodNotFoundError{
				Method: method,
				Args:   msg.Arguments,
			}
			return nil, nil, err
		}

		return msg, m, nil
	default:
		return nil, nil, fmt.Errorf("Method is not string or integer: %+v (%T)", msg.Method, msg.Method)
	}
}
755219
func UnwrapSNSMessage() MessageHandlerDecorator {
	return func(fn sqsconsumer.MessageHandlerFunc) sqsconsumer.MessageHandlerFunc {
		return func(ctx context.Context, msg string) error {
			var e snsEnvelope
			err := json.Unmarshal([]byte(msg), &e)
			if err == nil && isSNSMessage(e) {
				return fn(ctx, e.Message)
			}

			// if the message could not be unwrapped it may not have come through SNS so just passthrough
			return fn(ctx, msg)
		}
	}
}
1148212
func Wrap(err error, code string, message string) error {
	if err == nil {
		return nil
	}
	err = errors.Wrap(err, message)
	return argoerr{code, message, err.(stackTracer)}
}
594244
func Wrap(err error, msg string, args ...interface{}) error {
	e := &wrappedError{
		cause: err,
	}
	if len(args) == 0 {
		e.msg = msg
	} else {
		e.msg = fmt.Sprintf(msg, args...)
	}
	return e
}
1229123
func (s *SetTaskStatusInput) SetErrorMessage(v string) *SetTaskStatusInput {
	s.ErrorMessage = &v
	return s
}
891823
func (s *ErrorDetail) SetErrorMessage(v string) *ErrorDetail {
	s.ErrorMessage = &v
	return s
}
60929
func Wrapf(err error, format string, args ...interface{}) error {
	if err == nil {
		return nil
	}
	err = &withMessage{
		cause: err,
		msg:   fmt.Sprintf(format, args...),
	}
	return &withStack{
		err,
		stack.New(1),
	}
}
476119
func (t *T) ExpectErrorMessage(err error, msg string, desc ...string) {
	prefix := ""
	if len(desc) > 0 {
		prefix = strings.Join(desc, " ") + ": "
	}
	if err == nil {
		t.Fatalf("%sExpected error was not returned.", prefix)
	} else if !strings.Contains(err.Error(), msg) {
		t.Fatalf("%sError message didn't contain the expected message:\n"+
			"Error message=%s\nExpected string=%s", prefix, err.Error(), msg)
	}
}
1172152
func (s *FailedServiceActionAssociation) SetErrorMessage(v string) *FailedServiceActionAssociation {
	s.ErrorMessage = &v
	return s
}
342690
func (c *Called) NegatedFailureMessage(actual interface{}) (message string) {
	msg := fmt.Sprintf("Expected %#v not to be called", actual)
	if len(c.matched[0]) == 0 {
		return msg
	}
	return fmt.Sprintf("%s with args (%s)", msg, joinInter(c.matched[0], ", "))
}
553368
func WrapErrorTimeMessage(err error, m string) error {
	return newTimeStampError(errors.WithMessage(err, m))
}
1008972
func (q *Query) WrapWith(name string) *Query {
	wrapper := q.New()
	wrapper.with = q.with
	q.with = nil
	wrapper = wrapper.With(name, q)
	return wrapper
}
98209
func HandlerMessage(entry *logrus.Entry, _ *CustomFormatter) (interface{}, error) {
	return entry.Message, nil
}