fix(api-v2): rethrow unexpected errors in deleteSelectedCalendar catch block (#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>
This commit is contained in:
Tushar Khadde
2026-06-09 12:36:31 +05:30
committed by GitHub
co-authored by Bandhan Majumder
parent 75c5eb8531
commit ecfb05ba55
@@ -1,4 +1,4 @@
import { BadRequestException, Injectable, NotFoundException } from "@nestjs/common";
import { BadRequestException, Injectable, InternalServerErrorException, NotFoundException } from "@nestjs/common";
import { CalendarsService } from "@/platform/calendars/services/calendars.service";
import { CalendarsCacheService } from "@/platform/calendars/services/calendars-cache.service";
import {
@@ -58,8 +58,13 @@ export class SelectedCalendarsService {
throw new NotFoundException(NO_SELECTED_CALENDAR_FOUND);
} else if (error.message === MULTIPLE_SELECTED_CALENDARS_FOUND) {
throw new BadRequestException(MULTIPLE_SELECTED_CALENDARS_FOUND);
} else {
throw new InternalServerErrorException(error.message);
}
}
throw new InternalServerErrorException(
"An unexpected error occurred while deleting the selected calendar"
);
}
}
}