switch to twirp errors, correct RTC port

This commit is contained in:
David Zhao
2020-10-06 23:37:22 -07:00
parent 0d6c0adbdd
commit 38cc5454da
5 changed files with 9 additions and 32 deletions
+3 -4
View File
@@ -4,8 +4,7 @@ import (
"context"
"sync"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/twitchtv/twirp"
"github.com/livekit/livekit-server/pkg/node"
"github.com/livekit/livekit-server/proto"
@@ -33,7 +32,7 @@ func (s *SimpleRoomService) CreateRoom(ctx context.Context, req *proto.CreateRoo
defer s.roomLock.Unlock()
if s.rooms[req.Room] {
err = status.Errorf(codes.AlreadyExists, "room %s already exists", req.Room)
err = twirp.NewError(twirp.AlreadyExists, "room already exists")
return
}
@@ -49,7 +48,7 @@ func (s *SimpleRoomService) CreateRoom(ctx context.Context, req *proto.CreateRoo
func (s *SimpleRoomService) JoinRoom(ctx context.Context, req *proto.JoinRoomRequest) (res *proto.JoinRoomResponse, err error) {
if !s.rooms[req.Room] {
err = status.Errorf(codes.NotFound, "room %s does not exist", req.Room)
err = twirp.NewError(twirp.AlreadyExists, "the room does not exist")
return
}