You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(resharper): drop redundant namespace qualifiers in catch filters
ReSharper RedundantNameQualifier flagged all 45 occurrences of
Microsoft.EntityFrameworkCore.DbUpdateException and
Microsoft.Data.SqlClient.SqlException in the when-filtered catches
introduced by codeql/5. Replaced with the unqualified type names;
'using Microsoft.Data.SqlClient;' added to the 7 files that didn't
already have it.
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
108
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
Copy file name to clipboardExpand all lines: web/Areas/ClinicalScheduler/Services/PersonService.cs
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ public PersonService(ILogger<PersonService> logger, ClinicalSchedulerContext con
81
81
82
82
returnperson;
83
83
}
84
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
84
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
85
85
{
86
86
_logger.LogError(ex,"Error retrieving person data for MothraId: {MothraId}",LogSanitizer.SanitizeId(mothraId));
87
87
thrownewInvalidOperationException($"Failed to retrieve person data for MothraId {LogSanitizer.SanitizeId(mothraId)}",ex);
@@ -139,7 +139,7 @@ public async Task<List<ClinicianYearSummary>> GetCliniciansByYearAsync(int year,
139
139
_logger.LogInformation("Found {ClinicianCount} clinicians for year {Year} with person names from vPerson view",clinicians.Count,year);
140
140
returnclinicians;
141
141
}
142
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
142
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
143
143
{
144
144
_logger.LogError(ex,"Error retrieving clinicians for year: {Year}",year);
145
145
thrownewInvalidOperationException($"Failed to retrieve clinicians for grad year {year}. Check database connectivity and view permissions.",ex);
@@ -209,7 +209,7 @@ public async Task<List<ClinicianSummary>> GetCliniciansByGradYearRangeAsync(int
209
209
_logger.LogError(ex,"Database error retrieving clinicians for grad year range {StartYear}-{EndYear}",LogSanitizer.SanitizeYear(startGradYear),LogSanitizer.SanitizeYear(endGradYear));
210
210
thrownewInvalidOperationException($"Database error retrieving clinicians for grad year range {LogSanitizer.SanitizeYear(startGradYear)}-{LogSanitizer.SanitizeYear(endGradYear)}",ex);
211
211
}
212
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
212
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
213
213
{
214
214
_logger.LogError(ex,"Error retrieving clinicians for grad year range {StartYear}-{EndYear}",LogSanitizer.SanitizeYear(startGradYear),LogSanitizer.SanitizeYear(endGradYear));
215
215
thrownewInvalidOperationException($"Failed to retrieve clinicians for grad year range {LogSanitizer.SanitizeYear(startGradYear)}-{LogSanitizer.SanitizeYear(endGradYear)}",ex);
@@ -240,7 +240,7 @@ public async Task<List<string>> GetAllMothraIdsAsync(CancellationToken cancellat
240
240
_logger.LogInformation("Found {Count} unique MothraIds in Clinical Scheduler data",mothraIds.Count);
241
241
returnmothraIds;
242
242
}
243
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
243
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
thrownewInvalidOperationException("Failed to retrieve unique MothraIds from database",ex);
@@ -277,7 +277,7 @@ public async Task<List<ClinicianSummary>> GetAllActiveEmployeeAffiliatesAsync(Ca
277
277
_logger.LogDebug("Found {Count} active employee affiliates from AAUD",allAffiliates.Count);
278
278
returnallAffiliates;
279
279
}
280
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
280
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
281
281
{
282
282
_logger.LogError(ex,"Error retrieving active employee affiliates from AAUD");
283
283
thrownewInvalidOperationException("Failed to retrieve active employee affiliates from AAUD database",ex);
@@ -325,7 +325,7 @@ public async Task<List<ClinicianSummary>> GetAllActiveEmployeeAffiliatesAsync(Ca
325
325
326
326
returnclinician;
327
327
}
328
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
328
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
329
329
{
330
330
_logger.LogError(ex,"Error retrieving clinician data for MothraId: {MothraId} from AAUD",LogSanitizer.SanitizeId(mothraId));
331
331
thrownewInvalidOperationException($"Failed to retrieve clinician data for MothraId {LogSanitizer.SanitizeId(mothraId)} from AAUD",ex);
@@ -45,7 +46,7 @@ public async Task<List<RotationDto>> GetRotationsAsync(CancellationToken cancell
45
46
rotations.Count);
46
47
returnrotations.Select(r =>r.ToDto()).ToList();
47
48
}
48
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
49
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
49
50
{
50
51
_logger.LogError(ex,"Error retrieving rotations from Clinical Scheduler");
51
52
thrownewInvalidOperationException("Failed to retrieve rotations from Clinical Scheduler database",ex);
@@ -82,7 +83,7 @@ public async Task<List<RotationDto>> GetRotationsAsync(CancellationToken cancell
82
83
83
84
returnrotation?.ToDto();
84
85
}
85
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
86
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
86
87
{
87
88
_logger.LogError(ex,"Error retrieving rotation by ID: {RotationId}",rotationId);
88
89
thrownewInvalidOperationException($"Failed to retrieve rotation with ID {rotationId}",ex);
@@ -124,7 +125,7 @@ public async Task<List<Rotation>> GetRotationsByCourseAsync(string courseNumber,
124
125
125
126
returnrotations;
126
127
}
127
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
128
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
128
129
{
129
130
_logger.LogError(ex,"Error retrieving rotations by course - CourseNumber: {CourseNumber}, SubjectCode: {SubjectCode}",
130
131
courseNumber,subjectCode);
@@ -154,7 +155,7 @@ public async Task<List<RotationDto>> GetRotationsByServiceAsync(int serviceId, C
154
155
_logger.LogInformation("Retrieved {Count} rotations for service ID: {ServiceId}",rotations.Count,serviceId);
155
156
returnrotations.Select(r =>r.ToDto()).ToList();
156
157
}
157
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
158
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
158
159
{
159
160
_logger.LogError(ex,"Error retrieving rotations by service ID: {ServiceId}",serviceId);
160
161
thrownewInvalidOperationException($"Failed to retrieve rotations for service ID {serviceId}",ex);
@@ -180,7 +181,7 @@ public async Task<List<ServiceDto>> GetServicesAsync(CancellationToken cancellat
180
181
_logger.LogInformation("Retrieved {Count} services from Clinical Scheduler",services.Count);
181
182
returnservices.Select(s =>s.ToDto()).ToList();
182
183
}
183
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
184
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
184
185
{
185
186
_logger.LogError(ex,"Error retrieving services from Clinical Scheduler");
186
187
thrownewInvalidOperationException("Failed to retrieve services from Clinical Scheduler database",ex);
@@ -215,7 +216,7 @@ public async Task<List<ServiceDto>> GetServicesAsync(CancellationToken cancellat
215
216
216
217
returnservice?.ToDto();
217
218
}
218
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
219
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
219
220
{
220
221
_logger.LogError(ex,"Error retrieving service by ID: {ServiceId}",serviceId);
221
222
thrownewInvalidOperationException($"Failed to retrieve service with ID {serviceId}",ex);
@@ -265,7 +266,7 @@ public async Task<List<InstructorSchedule>> GetInstructorSchedulesByRotationAsyn
265
266
266
267
returnschedules;
267
268
}
268
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
269
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
269
270
{
270
271
_logger.LogError(ex,"Error retrieving instructor schedules for rotation ID: {RotationId}",rotationId);
271
272
thrownewInvalidOperationException($"Failed to retrieve instructor schedules for rotation ID {rotationId}",ex);
Copy file name to clipboardExpand all lines: web/Areas/ClinicalScheduler/Services/ScheduleAuditService.cs
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,4 @@
1
+
usingMicrosoft.Data.SqlClient;
1
2
usingMicrosoft.EntityFrameworkCore;
2
3
usingViper.Classes.SQLContext;
3
4
usingViper.Models.ClinicalScheduler;
@@ -114,7 +115,7 @@ public async Task<List<ScheduleAudit>> GetInstructorScheduleAuditHistoryAsync(
114
115
.OrderByDescending(a =>a.TimeStamp)
115
116
.ToListAsync(cancellationToken);
116
117
}
117
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
118
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
118
119
{
119
120
_logger.LogError(ex,"Error retrieving audit history for instructor schedule {ScheduleId}",instructorScheduleId);
120
121
thrownewInvalidOperationException($"Failed to retrieve audit history for instructor schedule {instructorScheduleId}. Please try again or contact support if the problem persists.",ex);
@@ -134,7 +135,7 @@ public async Task<List<ScheduleAudit>> GetRotationWeekAuditHistoryAsync(
134
135
.OrderByDescending(a =>a.TimeStamp)
135
136
.ToListAsync(cancellationToken);
136
137
}
137
-
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
138
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
138
139
{
139
140
_logger.LogError(ex,"Error retrieving audit history for rotation {RotationId}, week {WeekId}",rotationId,weekId);
140
141
thrownewInvalidOperationException($"Failed to retrieve audit history for rotation {rotationId}, week {weekId}. Please try again or contact support if the problem persists.",ex);
catch(Exceptionex)when(exisMicrosoft.EntityFrameworkCore.DbUpdateException or Microsoft.Data.SqlClient.SqlException or InvalidOperationException or OperationCanceledException)
183
+
catch(Exceptionex)when(exisDbUpdateException or SqlException or InvalidOperationException or OperationCanceledException)
183
184
{
184
185
_logger.LogError(ex,"Error creating audit entry for action {Action}, {MothraId} on rotation {RotationId}, week {WeekId}",
0 commit comments