mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 11:14:25 +00:00
Add some Sentry transactions.
This commit is contained in:
@@ -257,7 +257,8 @@ public class PluginRegister
|
||||
/// <returns>The filter that allows reading the specified path</returns>
|
||||
public IFilter GetFilter(string path)
|
||||
{
|
||||
IFilter noFilter = null;
|
||||
ITransactionTracer transaction = SentrySdk.StartTransaction("GetPlugin", "DetectFilter");
|
||||
IFilter noFilter = null;
|
||||
|
||||
foreach(IFilter filter in Filters.Values)
|
||||
{
|
||||
@@ -269,7 +270,12 @@ public class PluginRegister
|
||||
|
||||
var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke([]);
|
||||
|
||||
if(foundFilter?.Open(path) == ErrorNumber.NoError) return foundFilter;
|
||||
if(foundFilter?.Open(path) == ErrorNumber.NoError)
|
||||
{
|
||||
transaction.Finish();
|
||||
|
||||
return foundFilter;
|
||||
}
|
||||
}
|
||||
else
|
||||
noFilter = filter;
|
||||
@@ -281,10 +287,17 @@ public class PluginRegister
|
||||
}
|
||||
}
|
||||
|
||||
if(!noFilter?.Identify(path) == true) return null;
|
||||
if(!noFilter?.Identify(path) == true)
|
||||
{
|
||||
transaction.Finish();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
noFilter?.Open(path);
|
||||
|
||||
transaction.Finish();
|
||||
|
||||
return noFilter;
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,8 @@ public static class ArchiveFormat
|
||||
/// <returns>Detected archive plugin</returns>
|
||||
public static IArchive Detect(IFilter archiveFilter)
|
||||
{
|
||||
ITransactionTracer transaction = SentrySdk.StartTransaction("GetPlugin", "DetectArchive");
|
||||
|
||||
try
|
||||
{
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
@@ -76,12 +78,16 @@ public static class ArchiveFormat
|
||||
}
|
||||
|
||||
// Not recognized
|
||||
transaction.Finish();
|
||||
|
||||
return format;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
SentrySdk.CaptureException(ex);
|
||||
|
||||
transaction.Finish();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ using System.Linq;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Logging;
|
||||
using Sentry;
|
||||
|
||||
namespace Aaru.Core;
|
||||
|
||||
@@ -53,7 +54,8 @@ public static class Filesystems
|
||||
public static void Identify(IMediaImage imagePlugin, out List<string> idPlugins, Partition partition,
|
||||
bool getGuid = false)
|
||||
{
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
ITransactionTracer transaction = SentrySdk.StartTransaction("GetPlugin", "DetectFilesystem");
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
idPlugins = [];
|
||||
|
||||
@@ -66,13 +68,12 @@ public static class Filesystems
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
AaruLogging
|
||||
.Error(Localization.Core.Filesystems_Identify_Error,
|
||||
plugin.Name);
|
||||
AaruLogging.Error(Localization.Core.Filesystems_Identify_Error, plugin.Name);
|
||||
|
||||
AaruLogging.Exception(ex, Localization.Core.Filesystems_Identify_Error,
|
||||
plugin.Name);
|
||||
AaruLogging.Exception(ex, Localization.Core.Filesystems_Identify_Error, plugin.Name);
|
||||
}
|
||||
}
|
||||
|
||||
transaction.Finish();
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,8 @@ public static class ImageFormat
|
||||
/// <returns>Detected image plugin</returns>
|
||||
public static IBaseImage Detect(IFilter imageFilter)
|
||||
{
|
||||
ITransactionTracer transaction = SentrySdk.StartTransaction("GetPlugin", "DetectImageFormat");
|
||||
|
||||
try
|
||||
{
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
@@ -102,7 +104,12 @@ public static class ImageFormat
|
||||
}
|
||||
}
|
||||
|
||||
if(imageFormat != null) return imageFormat;
|
||||
if(imageFormat != null)
|
||||
{
|
||||
transaction.Finish();
|
||||
|
||||
return imageFormat;
|
||||
}
|
||||
|
||||
// Check only RAW plugin
|
||||
foreach(IMediaImage imagePlugin in plugins.MediaImages.Values)
|
||||
@@ -128,12 +135,16 @@ public static class ImageFormat
|
||||
}
|
||||
|
||||
// Still not recognized
|
||||
transaction.Finish();
|
||||
|
||||
return imageFormat;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
SentrySdk.CaptureException(ex);
|
||||
|
||||
transaction.Finish();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user