convert psprc error to http code in rtc service failure response (#3187)
This commit is contained in:
@@ -242,7 +242,12 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
prometheus.IncrementParticipantJoinFail(1)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user