Skip to content

Commit ecfb05b

Browse files
fix(api-v2): rethrow unexpected errors in deleteSelectedCalendar catch block (calcom#29519)
* fix(api-v2): rethrow unexpected errors as InternalServerErrorException in deleteSelectedCalendar * fix(selected-calendars): rethrow unexpected errors in deleteSelectedCalendar method * fix(selected-calendars): improve error handling in deleteSelectedCalendar method * fix lint and error handlers Refactor error handling in deleteSelectedCalendar method. --------- Co-authored-by: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com>
1 parent 75c5eb8 commit ecfb05b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

apps/api/v2/src/modules/selected-calendars/services/selected-calendars.service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BadRequestException, Injectable, NotFoundException } from "@nestjs/common";
1+
import { BadRequestException, Injectable, InternalServerErrorException, NotFoundException } from "@nestjs/common";
22
import { CalendarsService } from "@/platform/calendars/services/calendars.service";
33
import { CalendarsCacheService } from "@/platform/calendars/services/calendars-cache.service";
44
import {
@@ -58,8 +58,13 @@ export class SelectedCalendarsService {
5858
throw new NotFoundException(NO_SELECTED_CALENDAR_FOUND);
5959
} else if (error.message === MULTIPLE_SELECTED_CALENDARS_FOUND) {
6060
throw new BadRequestException(MULTIPLE_SELECTED_CALENDARS_FOUND);
61+
} else {
62+
throw new InternalServerErrorException(error.message);
6163
}
6264
}
65+
throw new InternalServerErrorException(
66+
"An unexpected error occurred while deleting the selected calendar"
67+
);
6368
}
6469
}
6570
}

0 commit comments

Comments
 (0)