Remove useless catch-and-rethrow blocks in Toolbox

Remove empty catch-and-rethrow blocks in Load() and Save() methods
that were catching exceptions only to rethrow them without adding
any value. This improves code clarity and exception propagation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
AJ
2025-11-18 16:02:36 -05:00
parent ee7275ac4f
commit 2c6fe924e5
+11 -25
View File
@@ -32,40 +32,26 @@ namespace CutList.Forms
/// </summary> /// </summary>
public void Load() public void Load()
{ {
try if (!File.Exists(ToolsFilePath))
{ {
if (!File.Exists(ToolsFilePath)) LoadDefaultTools();
{ Save();
LoadDefaultTools();
Save();
}
else
{
var json = File.ReadAllText(ToolsFilePath);
var list = JsonConvert.DeserializeObject<List<Tool>>(json);
Tools = list;
}
} }
catch (Exception ex) else
{ {
throw; var json = File.ReadAllText(ToolsFilePath);
var list = JsonConvert.DeserializeObject<List<Tool>>(json);
Tools = list;
} }
} }
public void Save() public void Save()
{ {
try if (Tools == null)
{ return;
if (Tools == null)
return;
var json = JsonConvert.SerializeObject(Tools, Formatting.Indented); var json = JsonConvert.SerializeObject(Tools, Formatting.Indented);
File.WriteAllText(ToolsFilePath, json); File.WriteAllText(ToolsFilePath, json);
}
catch (Exception ex)
{
throw;
}
} }
} }
} }