Skip to content

Commit 0833fa7

Browse files
Potential fix for pull request finding 'CodeQL / Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 58fefe6 commit 0833fa7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/Dashboard/AI/ChatEndpoints.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ void RecordPhase(string phase, double ms, object? extra = null)
118118
{
119119
var sw = Stopwatch.StartNew();
120120
try { var v = await fn(); sw.Stop(); return (name, v, sw.Elapsed.TotalMilliseconds, null); }
121-
catch (Exception ex) { sw.Stop(); return (name, null, sw.Elapsed.TotalMilliseconds, ex.Message); }
121+
catch (OperationCanceledException) { sw.Stop(); throw; }
122+
catch (HttpRequestException ex) { sw.Stop(); return (name, null, sw.Elapsed.TotalMilliseconds, ex.Message); }
123+
catch (UnauthorizedAccessException ex) { sw.Stop(); return (name, null, sw.Elapsed.TotalMilliseconds, ex.Message); }
124+
catch (InvalidOperationException ex) { sw.Stop(); return (name, null, sw.Elapsed.TotalMilliseconds, ex.Message); }
122125
}
123126
var fetchSw = Stopwatch.StartNew();
124127
var results = await Task.WhenAll(

0 commit comments

Comments
 (0)