Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/vendor/github.com/grafana/dskit/cancellation/error.go

37 lines
678 B

package cancellation
import (
"context"
"fmt"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type cancellationError struct {
inner error
}
func NewError(err error) error {
return cancellationError{err}
}
func NewErrorf(format string, args ...any) error {
return NewError(fmt.Errorf(format, args...))
}
func (e cancellationError) Error() string {
return "context canceled: " + e.inner.Error()
}
func (e cancellationError) Is(err error) bool {
return err == context.Canceled
}
func (e cancellationError) Unwrap() error {
return e.inner
}
func (e cancellationError) GRPCStatus() *status.Status {
return status.New(codes.Canceled, e.Error())
}