github.com/livekit/protocol@v1.39.3/ingress/errors.go (about)

     1  // Copyright 2023 LiveKit, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package ingress
    16  
    17  import (
    18  	"fmt"
    19  
    20  	"github.com/livekit/psrpc"
    21  )
    22  
    23  var (
    24  	ErrIngressOutOfDate        = psrpc.NewErrorf(psrpc.FailedPrecondition, "trying to ovewrite an ingress with an older version")
    25  	ErrIngressTimedOut         = psrpc.NewErrorf(psrpc.DeadlineExceeded, "ingress timed out")
    26  	ErrNoResponse              = psrpc.NewErrorf(psrpc.Unavailable, "no response from ingress service")
    27  	ErrInvalidOutputDimensions = NewInvalidVideoParamsError("invalid output media dimensions")
    28  	ErrInvalidIngressType      = psrpc.NewErrorf(psrpc.InvalidArgument, "invalid ingress type")
    29  	ErrIngressDisabled         = psrpc.NewErrorf(psrpc.PermissionDenied, "session is disabled")
    30  )
    31  
    32  func ErrInvalidIngress(s string) psrpc.Error {
    33  	return psrpc.NewErrorf(psrpc.InvalidArgument, "invalid ingress: %s", s)
    34  }
    35  
    36  func NewInvalidVideoParamsError(s string) error {
    37  	return psrpc.NewError(psrpc.InvalidArgument, fmt.Errorf("invalid video parameters: %s", s))
    38  }
    39  
    40  func NewInvalidAudioParamsError(s string) error {
    41  	return psrpc.NewError(psrpc.InvalidArgument, fmt.Errorf("invalid audio parameters: %s", s))
    42  }
    43  
    44  func NewInvalidTranscodingBypassError(s string) error {
    45  	return psrpc.NewError(psrpc.InvalidArgument, fmt.Errorf("invalid transcoding bypass configuration: %s", s))
    46  }