mirror of
https://github.com/bitwarden/server.git
synced 2024-12-24 17:17:40 +01:00
catch bad request exceptions to notification hub
This commit is contained in:
parent
7e2d0ed0c1
commit
49f4a773dc
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.Azure.NotificationHubs;
|
using Microsoft.Azure.NotificationHubs;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Bit.Core.Services
|
namespace Bit.Core.Services
|
||||||
{
|
{
|
||||||
@ -109,9 +110,19 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteRegistrationAsync(string deviceId)
|
public async Task DeleteRegistrationAsync(string deviceId)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await _client.DeleteInstallationAsync(deviceId);
|
await _client.DeleteInstallationAsync(deviceId);
|
||||||
}
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
if(!e.Message.Contains("(400) Bad Request"))
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task AddUserRegistrationOrganizationAsync(IEnumerable<string> deviceIds, string organizationId)
|
public async Task AddUserRegistrationOrganizationAsync(IEnumerable<string> deviceIds, string organizationId)
|
||||||
{
|
{
|
||||||
@ -139,9 +150,19 @@ namespace Bit.Core.Services
|
|||||||
};
|
};
|
||||||
|
|
||||||
foreach(var id in deviceIds)
|
foreach(var id in deviceIds)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await _client.PatchInstallationAsync(id, new List<PartialUpdateOperation> { operation });
|
await _client.PatchInstallationAsync(id, new List<PartialUpdateOperation> { operation });
|
||||||
}
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
if(!e.Message.Contains("(400) Bad Request"))
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user