func Errorf()

in api/pkg/handler/errors.go [37:64]


func Errorf(ctx context.Context, status int, msg string, format string, a ...interface{}) error {
	he := &httpError{
		err:    fmt.Errorf(format, a...),
		status: status,
		msg:    msg,
	}

	first := false

	if len(a) > 0 {
		pe, ok := a[len(a)-1].(*httpError)
		if ok {
			he.status = pe.status
			he.msg = pe.msg
		} else {
			first = true
		}
	} else {
		first = true
	}

	if first {
		logger := log.Ctx(ctx).With().CallerWithSkipFrameCount(3).Logger()
		logger.Error().Err(he).Msg(he.Error())
	}

	return he
}