backend: Add unauthorized participant error handling in room service
This commit is contained in:
parent
b3329958d8
commit
99839da05e
@ -60,6 +60,14 @@ export const errorRoomNotFound = (roomName: string): OpenViduMeetError => {
|
|||||||
|
|
||||||
// Participant errors
|
// Participant errors
|
||||||
|
|
||||||
|
export const errorParticipantUnauthorized = (roomName: string): OpenViduMeetError => {
|
||||||
|
return new OpenViduMeetError(
|
||||||
|
'Participant Error',
|
||||||
|
`Unauthorized generating token with received credentials in room '${roomName}'`,
|
||||||
|
406
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const errorParticipantNotFound = (participantName: string, roomName: string): OpenViduMeetError => {
|
export const errorParticipantNotFound = (participantName: string, roomName: string): OpenViduMeetError => {
|
||||||
return new OpenViduMeetError(
|
return new OpenViduMeetError(
|
||||||
'Participant Error',
|
'Participant Error',
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { OpenViduRoomHelper } from '../helpers/room.helper.js';
|
|||||||
import { SystemEventService } from './system-event.service.js';
|
import { SystemEventService } from './system-event.service.js';
|
||||||
import { TaskSchedulerService } from './task-scheduler.service.js';
|
import { TaskSchedulerService } from './task-scheduler.service.js';
|
||||||
import { ParticipantService } from './participant.service.js';
|
import { ParticipantService } from './participant.service.js';
|
||||||
|
import { errorParticipantUnauthorized } from '../models/error.model.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for managing OpenVidu Meet rooms.
|
* Service for managing OpenVidu Meet rooms.
|
||||||
@ -168,7 +169,7 @@ export class RoomService {
|
|||||||
return ParticipantRole.PUBLISHER;
|
return ParticipantRole.PUBLISHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error('Invalid secret');
|
throw errorParticipantUnauthorized(roomName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user