github.com/whoyao/protocol@v0.0.0-20230519045905-2d8ace718ca5/ingress/errors.go (about)

     1  package ingress
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/livekit/psrpc"
     7  )
     8  
     9  var (
    10  	ErrIngressOutOfDate        = psrpc.NewErrorf(psrpc.FailedPrecondition, "trying to ovewrite an ingress with an older version")
    11  	ErrIngressTimedOut         = psrpc.NewErrorf(psrpc.DeadlineExceeded, "ingress timed out")
    12  	ErrNoResponse              = psrpc.NewErrorf(psrpc.Unavailable, "no response from ingress service")
    13  	ErrInvalidOutputDimensions = NewInvalidVideoParamsError("invalid output media dimensions")
    14  	ErrInvalidIngressType      = psrpc.NewErrorf(psrpc.InvalidArgument, "invalid ingress type")
    15  )
    16  
    17  func ErrInvalidIngress(s string) psrpc.Error {
    18  	return psrpc.NewErrorf(psrpc.InvalidArgument, "invalid ingress: %s", s)
    19  }
    20  
    21  func NewInvalidVideoParamsError(s string) error {
    22  	return psrpc.NewError(psrpc.InvalidArgument, fmt.Errorf("invalid video parameters: %s", s))
    23  }
    24  
    25  func NewInvalidAudioParamsError(s string) error {
    26  	return psrpc.NewError(psrpc.InvalidArgument, fmt.Errorf("invalid audio parameters: %s", s))
    27  }