Don't crash on contact inserts.

This commit is contained in:
Burak Kaan Köse
2025-02-28 18:21:31 +01:00
parent 970a521b66
commit 6080646e89

View File

@@ -1,7 +1,9 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MimeKit;
using Serilog;
using SqlKata;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Interfaces;
@@ -51,6 +53,8 @@ public class ContactService : BaseDatabaseService, IContactService
{
var currentContact = await GetAddressInformationByAddressAsync(info.Address).ConfigureAwait(false);
try
{
if (currentContact == null)
{
await Connection.InsertAsync(info).ConfigureAwait(false);
@@ -60,5 +64,10 @@ public class ContactService : BaseDatabaseService, IContactService
await Connection.InsertOrReplaceAsync(info).ConfigureAwait(false);
}
}
catch (Exception ex)
{
Log.Error("Failed to add contact information to the database.", ex);
}
}
}
}