Skip to content

Commit

Permalink
[Core] Continue identifying filesystems if one of them throws an exce…
Browse files Browse the repository at this point in the history
…ption, and ask user to fill a report about it.

ROADMAP: Exceptions should automatically be sent to us in the future, if the user so agrees to.
  • Loading branch information
claunia committed Dec 1, 2023
1 parent 63c66f4 commit 05c4dbb
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Aaru.Core/Filesystems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;

namespace Aaru.Core;

Expand All @@ -53,9 +55,22 @@ public static void Identify(IMediaImage imagePlugin, out List<string> idPlugins,
{
PluginRegister plugins = PluginRegister.Singleton;

idPlugins = (from plugin in plugins.Filesystems.Values
where plugin is not null
where plugin.Identify(imagePlugin, partition)
select getGuid ? plugin.Id.ToString() : plugin.Name.ToLower()).ToList();
idPlugins = [];

foreach(IFilesystem plugin in plugins.Filesystems.Values.Where(p => p is not null))
{
try
{
if(plugin.Identify(imagePlugin, partition))
idPlugins.Add(getGuid ? plugin.Id.ToString() : plugin.Name.ToLower());
}
catch(Exception ex)
{
AaruConsole.
ErrorWriteLine("Error identifying filesystem {0}. Please open a report with the following line in a Github issue.",
plugin.Name);
AaruConsole.WriteException(ex);
}
}
}
}

0 comments on commit 05c4dbb

Please sign in to comment.