handle gracefully and log error (#17310)
This commit is contained in:
+10
-1
@@ -56,10 +56,19 @@ export const getRoundRobinHostsToReassign = async ({ ctx, input }: GetRoundRobin
|
||||
// Get event type
|
||||
const eventType = await getEventTypesFromDB(booking.eventType.id);
|
||||
|
||||
if (!eventType || !eventType.teamId) {
|
||||
if (!eventType) {
|
||||
throw new Error("Event type not found");
|
||||
}
|
||||
|
||||
if (!eventType.teamId) {
|
||||
gettingRoundRobinHostsToReassignLogger.warn("Booking with event type that has no teamId", {
|
||||
bookingId: input.bookingId,
|
||||
eventTypeId: eventType.id,
|
||||
teamId: eventType.teamId ?? -1,
|
||||
});
|
||||
return [];
|
||||
}
|
||||
|
||||
const availableEventTypeUsers = eventType.hosts
|
||||
.filter((h) => !h.isFixed && h.user.id !== booking.userId)
|
||||
.map((host) => ({
|
||||
|
||||
Reference in New Issue
Block a user