// WrapErrorTimeMessage annotates an error with the timestamp and a
// string form. The underlying concrete object implements
// message.Composer as well as error.
553368
func WrapErrorTimeMessage(err error, m string) error {
	return newTimeStampError(errors.WithMessage(err, m))
}
1353619
func Wrap(err error, message string) error {
	if err == nil {
		return nil
	}
	err = &withMessage{
		cause: err,
		msg:   message,
	}
	return &withStack{
		err,
		callers(),
	}
}
11855
func (s *Workspace) SetErrorMessage(v string) *Workspace {
	s.ErrorMessage = &v
	return s
}
646501
func (s *UnprocessedNamedQueryId) SetErrorMessage(v string) *UnprocessedNamedQueryId {
	s.ErrorMessage = &v
	return s
}
195507
func Wrapf(err error, format string, a ...interface{}) error {
	if err == nil {
		return nil
	}
	return &wrapped{
		err: err,
		msg: fmt.Sprintf(format, a...),
	}
}
1036940
func AWSErrorMessage(err error) string {
	if awsError, ok := err.(awserr.Error); ok {
		return awsError.Message()
	}
	return ""
}
265247
func (s *ConfigurationRecorderStatus) SetLastErrorMessage(v string) *ConfigurationRecorderStatus {
	s.LastErrorMessage = &v
	return s
}
1190245
func Retry(err error, message string, args ...interface{}) error {
	return WrapWithMessage(&RetryError{
		Message: fmt.Sprintf(message, args...),
		Err:     err,
	}, message, args...)
}
762319
func (s *FailureInfo) SetErrorMessage(v string) *FailureInfo {
	s.ErrorMessage = &v
	return s
}
556113
func (s *PutRecordsResultEntry) SetErrorMessage(v string) *PutRecordsResultEntry {
	s.ErrorMessage = &v
	return s
}
1067386
func TreeMessage(err error) string {
	if err == nil {
		return ""
	}

	var buf bytes.Buffer
	depth := 1
	for {
		if depth > 1 {
			buf.WriteString("\n|")
			buf.WriteString(strings.Repeat(" ", (depth-1)*3-1))
		}

		if e, ok := err.(*error2); ok {
			buf.WriteString("├─ " + e.Message + " -> " + e.Location.String())
			err = e.Inner
		} else {
			buf.WriteString("└─ " + err.Error())
			err = nil
		}

		if err == nil {
			break
		}

		depth++
	}

	return buf.String()
}
106146
func getLastRuntimeError(r *runc.Runc) (string, error) {
	if r.Log == "" {
		return "", nil
	}

	f, err := os.OpenFile(r.Log, os.O_RDONLY, 0400)
	if err != nil {
		return "", err
	}

	var (
		errMsg string
		log    struct {
			Level string
			Msg   string
			Time  time.Time
		}
	)

	dec := json.NewDecoder(f)
	for err = nil; err == nil; {
		if err = dec.Decode(&log); err != nil && err != io.EOF {
			return "", err
		}
		if log.Level == "error" {
			errMsg = strings.TrimSpace(log.Msg)
		}
	}

	return errMsg, nil
}
618144
func (f *FailureResponse) AppendErrorMessage(msg string) *FailureResponse {
	return &FailureResponse{
		error:         errors.New(fmt.Sprintf("%s %s", f.Error(), msg)),
		statusCode:    f.statusCode,
		loggerAction:  f.loggerAction,
		emptyResponse: f.emptyResponse,
		errorKey:      f.errorKey,
	}
}
713623
func (a *application) processMessage(c context.Context, coll *collector.Collector, msg *pubsub.Message) bool {
	log.Fields{
		"size": len(msg.Data),
	}.Infof(c, "Received Pub/Sub Message.")

	startTime := clock.Now(c)
	err := coll.Process(c, msg.Data)
	duration := clock.Now(c).Sub(startTime)

	// We track processing time in milliseconds.
	tsTaskProcessingTime.Add(c, duration.Seconds()*1000)

	switch {
	case transient.Tag.In(err):
		// Do not consume
		log.Fields{
			log.ErrorKey: err,
			"duration":   duration,
		}.Warningf(c, "TRANSIENT error ingesting Pub/Sub message.")
		tsPubsubCount.Add(c, 1, "transient_failure")
		return false

	case err == nil:
		log.Fields{
			"size":     len(msg.Data),
			"duration": duration,
		}.Infof(c, "Message successfully processed; ACKing.")
		tsPubsubCount.Add(c, 1, "success")
		return true

	default:
		log.Fields{
			log.ErrorKey: err,
			"size":       len(msg.Data),
			"duration":   duration,
		}.Errorf(c, "Non-transient error ingesting Pub/Sub message; ACKing.")
		tsPubsubCount.Add(c, 1, "failure")
		return true
	}
}
865233
func errorMessage(httpStatusCode int, responseBody string) error {
	if httpStatusCode >= 400 && httpStatusCode < 500 {
		message := fmt.Sprintf("Client error occurred; Response Code: %d, Response Body: %s", httpStatusCode, responseBody)
		logging.Logger().Warn(message)
		return errors.New(message)
	}
	if httpStatusCode >= 500 {
		message := fmt.Sprintf("Server error occurred; Response Code: %d, Response Body: %s", httpStatusCode, responseBody)
		logging.Logger().Info(message)
		return errors.New(message)
	}
	return nil
}
154500
func Annotate(err error, msg string) error {
	if err == nil {
		return nil
	}
	return Wrap(errors.New(msg), err)
}
164402
func Wrap(err error, message string) error {
	return errs.Wrap(err, message)
}