From 10fdcb288c5f8b26507a6cc1bdd0001ce101a4ae Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 7 Sep 2026 10:58:20 +0100 Subject: [PATCH] unique email handling --- src/Yavsc.Org/Controllers/Accounting/AccountController.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Yavsc.Org/Controllers/Accounting/AccountController.cs b/src/Yavsc.Org/Controllers/Accounting/AccountController.cs index 44927d461..3fd8a0159 100644 --- a/src/Yavsc.Org/Controllers/Accounting/AccountController.cs +++ b/src/Yavsc.Org/Controllers/Accounting/AccountController.cs @@ -25,6 +25,7 @@ using IdentityModel; using Yavsc.Server.Helpers; using Microsoft.AspNetCore.Mvc.Localization; using System.Diagnostics; +using System.Data.Common; namespace Yavsc.Controllers { @@ -538,9 +539,9 @@ IHtmlLocalizerFactory htmlLocalizerFactory, { for (var current = exception; current is not null; current = current.InnerException) { - if (current is PostgresException pg - && pg.SqlState == PostgresErrorCodes.UniqueViolation - && string.Equals(pg.ConstraintName, "AK_AspNetUsers_Email", StringComparison.Ordinal)) + if (current is DbException pg + && pg.ErrorCode == 23505) + // UNIQUE VIOLATION https://www.postgresql.org/docs/8.4/errcodes-appendix.html { return true; }