Skip to content

Commit 2aa851a

Browse files
committed
Updating dispatch rule error message
1 parent daedd9b commit 2aa851a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

sip/sip.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ func printID(s string) string {
131131
return s
132132
}
133133

134+
func printName(s string) string {
135+
if s == "" {
136+
return "<blank name>"
137+
}
138+
return s
139+
}
140+
134141
// ValidateDispatchRules checks a set of dispatch rules for conflicts.
135142
//
136143
// Deprecated: use ValidateDispatchRulesIter
@@ -208,8 +215,9 @@ func (v *DispatchRuleValidator) Validate(r *livekit.SIPDispatchRuleInfo) error {
208215
if v.opt.AllowConflicts {
209216
continue
210217
}
211-
return twirp.NewErrorf(twirp.InvalidArgument, "Conflicting SIP Dispatch Rules: same Trunk+Number+PIN combination for for %q and %q",
212-
printID(r.SipDispatchRuleId), printID(r2.SipDispatchRuleId))
218+
return twirp.NewErrorf(twirp.InvalidArgument,
219+
"Dispatch rule for the same trunk, number, and pin combination already exists in dispatch rule %q %q",
220+
printID(r2.SipDispatchRuleId), printName(r2.Name))
213221
}
214222
v.byRuleKey[key] = r
215223
}

0 commit comments

Comments
 (0)