1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-27 03:52:57 +02:00

PM-5154 Avoid logging Fido2AuthenticatorExceptions (#3169)

This commit is contained in:
Federico Maccaroni 2024-04-17 17:42:36 -03:00 committed by GitHub
parent 8a0501f0f9
commit 350a22d20e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View File

@ -24,5 +24,23 @@ namespace Bit.Core.Utilities
onException?.Invoke(ex);
}
}
/// <summary>
/// Fires a task and ignores any exception.
/// See http://stackoverflow.com/a/22864616/344182
/// </summary>
/// <param name="task">The task to be forgotten.</param>
/// <param name="onException">Action to be called on exception.</param>
public static async void FireAndForget(this Task task, Func<Exception, bool> shouldLogException)
{
try
{
await task.ConfigureAwait(false);
}
catch (Exception ex) when (shouldLogException(ex))
{
LoggerHelper.LogEvenIfCantBeResolved(ex);
}
}
}
}

View File

@ -147,7 +147,7 @@ namespace Bit.iOS.Autofill
CPViewController.VerifyUserAsync,
Source.ReloadWithAllowedFido2Credentials);
DoFido2GetAssertionAsync(fido2UserInterface).FireAndForget();
DoFido2GetAssertionAsync(fido2UserInterface).FireAndForget(ex => ex is not Fido2AuthenticatorException);
}
else
{