github.com/livekit/protocol@v1.16.1-0.20240517185851-47e4c6bba773/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  )
    30  
    31  func ErrInvalidIngress(s string) psrpc.Error {
    32  	return psrpc.NewErrorf(psrpc.InvalidArgument, "invalid ingress: %s", s)
    33  }
    34  
    35  func NewInvalidVideoParamsError(s string) error {
    36  	return psrpc.NewError(psrpc.InvalidArgument, fmt.Errorf("invalid video parameters: %s", s))
    37  }
    38  
    39  func NewInvalidAudioParamsError(s string) error {
    40  	return psrpc.NewError(psrpc.InvalidArgument, fmt.Errorf("invalid audio parameters: %s", s))
    41  }
    42  
    43  func NewInvalidTranscodingBypassError(s string) error {
    44  	return psrpc.NewError(psrpc.InvalidArgument, fmt.Errorf("invalid transcoding bypass configuration: %s", s))
    45  }