6584163911
* Rhino uses SendOperationManagerFactory * revit now uses it * autocad and civil use it * csi, tekla and NW * add test * formatting * tested with rhino and revit * formatting --------- Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
25 lines
854 B
C#
25 lines
854 B
C#
using Microsoft.Extensions.Logging;
|
|
using Speckle.Sdk;
|
|
|
|
namespace Speckle.Connectors.DUI.Logging;
|
|
|
|
/// <remarks>
|
|
/// These helper functions are designed because we are handling all <see cref="Exception"/>s using the model card
|
|
/// But we still would like to discriminate the severity via logging.
|
|
/// If we ever decide to be more specific with our exception catching within bindings (to allow unexpected exceptions to bubble up to the top level)
|
|
/// then these functions likely won't be useful.
|
|
/// </remarks>
|
|
public static class HandledModelCardErrors
|
|
{
|
|
public static void LogModelCardHandledError<T>(this ILogger<T> logger, Exception ex)
|
|
{
|
|
LogLevel level = ex switch
|
|
{
|
|
SpeckleException => LogLevel.Warning,
|
|
_ => LogLevel.Error
|
|
};
|
|
|
|
logger.Log(level, ex, "{bindingType} operation was not successful", typeof(T));
|
|
}
|
|
}
|