convert psprc error to http code in rtc service failure response (#3187)

This commit is contained in:
Paul Wells
2024-11-19 19:45:00 -08:00
committed by GitHub
parent d0343808f2
commit 73fbc6b8bb
+6 -1
View File
@@ -242,7 +242,12 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if err != nil {
prometheus.IncrementParticipantJoinFail(1)
handleError(w, r, http.StatusInternalServerError, err, loggerFields...)
status := http.StatusInternalServerError
var psrpcErr psrpc.Error
if errors.As(err, &psrpcErr) {
status = psrpcErr.ToHttp()
}
handleError(w, r, status, err, loggerFields...)
return
}