mirror of
https://github.com/XFox111/bonch-calendar.git
synced 2026-04-22 07:08:01 +03:00
feat(dev): improved logging for failed calendar generation
This commit is contained in:
@@ -97,6 +97,8 @@ app.MapGet("/timetable/{facultyId}/{groupId}", async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
DateTime semesterStartDate = await apiService.GetSemesterStartDateAsync(groupId);
|
DateTime semesterStartDate = await apiService.GetSemesterStartDateAsync(groupId);
|
||||||
string groupName = (await apiService.GetGroupsListAsync(facultyId, 0))[groupId];
|
string groupName = (await apiService.GetGroupsListAsync(facultyId, 0))[groupId];
|
||||||
|
|
||||||
@@ -121,6 +123,12 @@ app.MapGet("/timetable/{facultyId}/{groupId}", async (
|
|||||||
await File.WriteAllTextAsync(cacheFile, serialized);
|
await File.WriteAllTextAsync(cacheFile, serialized);
|
||||||
logger.LogInformation("Cached timetable for group {GroupId} to {CacheFile}.", groupId, cacheFile);
|
logger.LogInformation("Cached timetable for group {GroupId} to {CacheFile}.", groupId, cacheFile);
|
||||||
return Results.Text(serialized, contentType: "text/calendar");
|
return Results.Text(serialized, contentType: "text/calendar");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "Failed to generate timetable for group {GroupId} of faculty {FacultyId}.", groupId, facultyId);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.WithName("GetTimetable")
|
.WithName("GetTimetable")
|
||||||
.WithDescription("Gets the iCal timetable for the specified group.")
|
.WithDescription("Gets the iCal timetable for the specified group.")
|
||||||
|
|||||||
Reference in New Issue
Block a user