Skip to content

Commit

Permalink
fix: don't investigate timeout errors as EF migration issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Dec 12, 2024
1 parent 5bc22f2 commit cbeb5a5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/IntelliTect.Coalesce/Api/Controllers/ApiActionFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Microsoft.Net.Http.Headers;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Common;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -93,10 +94,11 @@ public virtual void OnActionExecuted(ActionExecutedContext context)
currentEx = currentEx.InnerException;
}
string message = messages.ToString();

if (
options.Value.DetailedEfMigrationExceptionMessages &&
(context.Exception as DbException ?? context.Exception?.InnerException) is DbException
(context.Exception as DbException ?? context.Exception?.InnerException) is DbException dbEx &&
dbEx.InnerException is not Win32Exception { NativeErrorCode: 258 } // The wait operation timed out
)
{
var dbMessage = GetDbContextMigrationExceptionMessage(context);
Expand Down Expand Up @@ -199,7 +201,7 @@ private static string GetDbContextMigrationExceptionMessage(ActionExecutedContex

if (messages.Count == 0) return "";

return string.Join(" ", messages) + " This is the likely cause of the following error:";
return string.Join(" ", messages) + " This is possibly the cause of the following error:";
}

public void OnResultExecuting(ResultExecutingContext context)
Expand Down

0 comments on commit cbeb5a5

Please sign in to comment.