// dieIfError calls each callback in turn before printing the error via log.Fatalln.
435399
func dieIfError(err error, cleanup ...func()) {
	if err != nil {
		log.Println("Error:")
		for _, cb := range cleanup {
			cb()
		}
		log.Fatalln(err.Error())
	}
	return
}
859562
func (logger *Logger) Fatalln(v ...interface{}) {
	logger.Output(2, fmt.Sprintln(v...))
	os.Exit(1)
}
222897
func (l *Logger) Error(a ...interface{}) {
	l.logAll(optError, fmt.Sprint(a...))
}
28744
func (e *StatusError) DebugError() (string, []interface{}) {
	if out, err := json.MarshalIndent(e.ErrStatus, "", "  "); err == nil {
		return "server response object: %s", []interface{}{string(out)}
	}
	return "server response object: %#v", []interface{}{e.ErrStatus}
}
1012123
func Fatalf(
	nestedError NestedError,
	message string,
	args ...interface{},
) {
	fmt.Fprintln(os.Stderr, Errorf(nestedError, message, args...))
	exiter(1)
}
537506
func makeCLIError(msg string, args ...interface{}) error {
	return commandLineError{fmt.Errorf(msg, args...)}
}
1141744
func ErrorHandler(h utils.ErrorHandler) LBOption {
	return func(s *RoundRobin) error {
		s.errHandler = h
		return nil
	}
}
1319199
func CheckIfError(err error) {
	if err == nil {
		return
	}

	fmt.Printf("\x1b[31;1m%s\x1b[0m\n", fmt.Sprintf("error: %s", err))
	os.Exit(1)
}
870890
func (d *defaulter) logError(format string, err error) {
	if !d.log {
		return
	}
	format += ": %v"
	if len(d.id) > 0 {
		logger.Errorf("(%s) "+format, d.id, err)
	} else {
		logger.Errorf(format, err)
	}
}
588000
func (me *Logger) Fatalln(v ...interface{}) {
	me.setFullPrefix(Pfatal)
	me.logger.Fatalln(v...)
}
1103871
func (e *ErrorObject) Error() string {
	err := fmt.Sprintf("%v error", e.Code)
	if e.Field != "" {
		err = fmt.Sprintf("%v caused by %v field", err, e.Field)
	}
	err = fmt.Sprintf("%v on %v resource", err, e.Resource)
	if e.Message != "" {
		err = fmt.Sprintf("%v: %v", err, e.Message)
	}

	return err
}
1837
func Fatalf(code int, format string, args ...interface{}) error {
	return fatalErr{
		code:  code,
		error: fmt.Errorf(format, args...),
	}
}
1258624
func RetryableError(err error) *RetryError {
	if err == nil {
		return nil
	}
	return &RetryError{Err: err, Retryable: true}
}
706584
func (c *Client) die(err error, close bool, fromCallback bool) error {
	c.finish.Do(func() {
		err = c.cleanup(err, close, false)

		if c.Callback != nil && !fromCallback {
			returnedErr := c.Callback(nil, err)
			if returnedErr == nil {
				err = nil
			}
		}
	})

	return err
}
1148031
func (l *Logger) Fatalf(format string, a ...interface{}) {
	l.Print(l.formatErr(fmt.Errorf(format, a...), ""))
	os.Exit(254)
}
650198
func (l *Logger) handleError(err error) error {
	h := l.errorHandler.Load().(func(error) error)
	if h == nil {
		return err
	}
	return h(err)
}
815366
func Error(format string, v ...interface{}) {
	log.Error(fmt.Sprintf(format, v...))
}