Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tame-buckets-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/protocol": patch
---

Use string constant as parameter to twirp.NewErrorf
4 changes: 2 additions & 2 deletions sip/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ func MatchDispatchRuleIter(trunk *livekit.SIPInboundTrunkInfo, rules iters.Iter[
}
if specificRuleCnt == 0 && defaultRuleCnt == 0 {
err := &ErrNoDispatchMatched{NoRules: true, NoTrunks: trunk == nil, CalledNumber: req.CalledNumber}
return nil, twirp.WrapError(twirp.NewErrorf(twirp.FailedPrecondition, err.Error()), err)
return nil, twirp.WrapError(twirp.NewErrorf(twirp.FailedPrecondition, "%s", err.Error()), err)
}
if specificRule != nil {
return specificRule, nil
Expand All @@ -786,7 +786,7 @@ func MatchDispatchRuleIter(trunk *livekit.SIPInboundTrunkInfo, rules iters.Iter[
return defaultRule, nil
}
err := &ErrNoDispatchMatched{NoRules: false, NoTrunks: trunk == nil, CalledNumber: req.CalledNumber}
return nil, twirp.WrapError(twirp.NewErrorf(twirp.FailedPrecondition, err.Error()), err)
return nil, twirp.WrapError(twirp.NewErrorf(twirp.FailedPrecondition, "%s", err.Error()), err)
}

// EvaluateDispatchRule checks a selected Dispatch Rule against the provided request.
Expand Down
24 changes: 12 additions & 12 deletions utils/data_channel_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,29 @@ func (e *DataChannelRpcError) Error() string {
func (e *DataChannelRpcError) PsrpcError() psrpc.Error {
switch e.Code {
case DataChannelRpcApplicationError:
return psrpc.NewErrorf(psrpc.Internal, e.Error())
return psrpc.NewErrorf(psrpc.Internal, "%s", e.Error())
case DataChannelRpcConnectionTimeout:
return psrpc.NewErrorf(psrpc.Canceled, e.Error())
return psrpc.NewErrorf(psrpc.Canceled, "%s", e.Error())
case DataChannelRpcResponseTimeout:
return psrpc.NewErrorf(psrpc.Canceled, e.Error())
return psrpc.NewErrorf(psrpc.Canceled, "%s", e.Error())
case DataChannelRpcRecipientDisconnected:
return psrpc.NewErrorf(psrpc.Unavailable, e.Error())
return psrpc.NewErrorf(psrpc.Unavailable, "%s", e.Error())
case DataChannelRpcResponsePayloadTooLarge:
return psrpc.NewErrorf(psrpc.MalformedResponse, e.Error())
return psrpc.NewErrorf(psrpc.MalformedResponse, "%s", e.Error())
case DataChannelRpcSendFailed:
return psrpc.NewErrorf(psrpc.Internal, e.Error())
return psrpc.NewErrorf(psrpc.Internal, "%s", e.Error())
case DataChannelRpcUnsupportedMethod:
return psrpc.NewErrorf(psrpc.InvalidArgument, e.Error())
return psrpc.NewErrorf(psrpc.InvalidArgument, "%s", e.Error())
case DataChannelRpcRecipientNotFound:
return psrpc.NewErrorf(psrpc.NotFound, e.Error())
return psrpc.NewErrorf(psrpc.NotFound, "%s", e.Error())
case DataChannelRpcRequestPayloadTooLarge:
return psrpc.NewErrorf(psrpc.MalformedRequest, e.Error())
return psrpc.NewErrorf(psrpc.MalformedRequest, "%s", e.Error())
case DataChannelRpcUnsupportedServer:
return psrpc.NewErrorf(psrpc.Unimplemented, e.Error())
return psrpc.NewErrorf(psrpc.Unimplemented, "%s", e.Error())
case DataChannelRpcUnsupportedVersion:
return psrpc.NewErrorf(psrpc.Unimplemented, e.Error())
return psrpc.NewErrorf(psrpc.Unimplemented, "%s", e.Error())
default:
return psrpc.NewErrorf(psrpc.Internal, e.Error())
return psrpc.NewErrorf(psrpc.Internal, "%s", e.Error())
}
}

Expand Down
Loading