Skip to content

Commit fa7d4c7

Browse files
committed
btdu.ui.browser: Add error handling for data export
Wrap the export operation in a try-catch block. When export fails, display the error message and wait for a keypress before continuing.
1 parent dcbb7b9 commit fa7d4c7

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

source/btdu/ui/browser.d

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,8 +2131,17 @@ struct Browser
21312131
}
21322132

21332133
outputFile.writeln("Exporting..."); outputFile.flush();
2134-
exportData(path, fmt);
2135-
logMessage("Exported to " ~ path);
2134+
try
2135+
{
2136+
exportData(path, fmt);
2137+
logMessage("Exported to " ~ path);
2138+
}
2139+
catch (Exception e)
2140+
{
2141+
outputFile.writeln("Export failed: ", e.msg);
2142+
outputFile.writeln();
2143+
readKey("Press any key to continue...");
2144+
}
21362145
});
21372146
}
21382147

0 commit comments

Comments
 (0)