Skip to content

Commit

Permalink
Check SqlState instead of exception message
Browse files Browse the repository at this point in the history
...when trying to truncate a non-existing table.
  • Loading branch information
Tobias Grimm committed Jan 14, 2025
1 parent e8df125 commit 79a9397
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Marten/Internal/Storage/DocumentStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void TruncateDocumentStorage(IMartenDatabase database)
}
catch (PostgresException e)
{
if (!e.Message.Contains("does not exist"))
if (e.SqlState != PostgresErrorCodes.UndefinedTable)
{
throw;
}
Expand All @@ -178,7 +178,7 @@ public async Task TruncateDocumentStorageAsync(IMartenDatabase database, Cancell
}
catch (PostgresException e)
{
if (!e.Message.Contains("does not exist"))
if (e.SqlState != PostgresErrorCodes.UndefinedTable)
{
throw;
}
Expand Down

0 comments on commit 79a9397

Please sign in to comment.