mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +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 {
|
Future<void> share(BuildContext context) async {
|
||||||
final filePath = (await getAppDir()).path + "/debug.log";
|
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 ShareUtil.shareFile(filePath: filePath, fileName: "debug.log", context: context);
|
||||||
await mwebSettingsViewModelBase.removeLogsLocally(filePath);
|
await mwebSettingsViewModelBase.removeLogsLocally(filePath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ abstract class MwebSettingsViewModelBase with Store {
|
||||||
_settingsStore.mwebAlwaysScan = value;
|
_settingsStore.mwebAlwaysScan = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> saveLogsLocally(String filePath) async {
|
Future<bool> saveLogsLocally(String filePath) async {
|
||||||
try {
|
try {
|
||||||
final appSupportPath = (await getApplicationSupportDirectory()).path;
|
final appSupportPath = (await getApplicationSupportDirectory()).path;
|
||||||
final logsFile = File("$appSupportPath/logs/debug.log");
|
final logsFile = File("$appSupportPath/logs/debug.log");
|
||||||
|
@ -55,12 +55,14 @@ abstract class MwebSettingsViewModelBase with Store {
|
||||||
throw Exception('Logs file does not exist');
|
throw Exception('Logs file does not exist');
|
||||||
}
|
}
|
||||||
await logsFile.copy(filePath);
|
await logsFile.copy(filePath);
|
||||||
|
return true;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
ExceptionHandler.onError(FlutterErrorDetails(
|
ExceptionHandler.onError(FlutterErrorDetails(
|
||||||
exception: e,
|
exception: e,
|
||||||
stack: s,
|
stack: s,
|
||||||
library: "Export Logs",
|
library: "Export Logs",
|
||||||
));
|
));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue