mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
[skip ci] exception handling
This commit is contained in:
parent
0603aaa19e
commit
887021a6b1
2 changed files with 5 additions and 2 deletions
|
@ -102,7 +102,8 @@ class MwebLogsPage extends BasePage {
|
|||
|
||||
Future<void> share(BuildContext context) async {
|
||||
final filePath = (await getAppDir()).path + "/debug.log";
|
||||
await mwebSettingsViewModelBase.saveLogsLocally(filePath);
|
||||
bool success = await mwebSettingsViewModelBase.saveLogsLocally(filePath);
|
||||
if (!success) return;
|
||||
await ShareUtil.shareFile(filePath: filePath, fileName: "debug.log", context: context);
|
||||
await mwebSettingsViewModelBase.removeLogsLocally(filePath);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ abstract class MwebSettingsViewModelBase with Store {
|
|||
_settingsStore.mwebAlwaysScan = value;
|
||||
}
|
||||
|
||||
Future<void> saveLogsLocally(String filePath) async {
|
||||
Future<bool> saveLogsLocally(String filePath) async {
|
||||
try {
|
||||
final appSupportPath = (await getApplicationSupportDirectory()).path;
|
||||
final logsFile = File("$appSupportPath/logs/debug.log");
|
||||
|
@ -55,12 +55,14 @@ abstract class MwebSettingsViewModelBase with Store {
|
|||
throw Exception('Logs file does not exist');
|
||||
}
|
||||
await logsFile.copy(filePath);
|
||||
return true;
|
||||
} catch (e, s) {
|
||||
ExceptionHandler.onError(FlutterErrorDetails(
|
||||
exception: e,
|
||||
stack: s,
|
||||
library: "Export Logs",
|
||||
));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue