mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
exception handling [skip ci]
This commit is contained in:
parent
1b8ed9251e
commit
d3974be9d4
2 changed files with 18 additions and 17 deletions
|
@ -1,6 +1,5 @@
|
|||
import 'dart:io';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
@ -81,17 +80,9 @@ class MwebLogsPage extends BasePage {
|
|||
rightButtonText: S.of(context).save_to_downloads,
|
||||
leftButtonText: S.of(context).share,
|
||||
actionRightButton: () async {
|
||||
try {
|
||||
const downloadDirPath = "/storage/emulated/0/Download";
|
||||
final filePath = downloadDirPath + "/debug.log";
|
||||
await mwebSettingsViewModelBase.saveLogsLocally(filePath);
|
||||
} catch (e, s) {
|
||||
ExceptionHandler.onError(FlutterErrorDetails(
|
||||
exception: e,
|
||||
stack: s,
|
||||
library: "Export Logs",
|
||||
));
|
||||
}
|
||||
const downloadDirPath = "/storage/emulated/0/Download";
|
||||
final filePath = downloadDirPath + "/debug.log";
|
||||
await mwebSettingsViewModelBase.saveLogsLocally(filePath);
|
||||
Navigator.of(dialogContext).pop();
|
||||
},
|
||||
actionLeftButton: () async {
|
||||
|
|
|
@ -2,7 +2,9 @@ import 'dart:io';
|
|||
|
||||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/utils/exception_handler.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
|
@ -46,12 +48,20 @@ abstract class MwebSettingsViewModelBase with Store {
|
|||
}
|
||||
|
||||
Future<void> saveLogsLocally(String filePath) async {
|
||||
final appSupportPath = (await getApplicationSupportDirectory()).path;
|
||||
final logsFile = File("$appSupportPath/logs/debug.log");
|
||||
if (!logsFile.existsSync()) {
|
||||
throw Exception('Logs file does not exist');
|
||||
try {
|
||||
final appSupportPath = (await getApplicationSupportDirectory()).path;
|
||||
final logsFile = File("$appSupportPath/logs/debug.log");
|
||||
if (!logsFile.existsSync()) {
|
||||
throw Exception('Logs file does not exist');
|
||||
}
|
||||
await logsFile.copy(filePath);
|
||||
} catch (e, s) {
|
||||
ExceptionHandler.onError(FlutterErrorDetails(
|
||||
exception: e,
|
||||
stack: s,
|
||||
library: "Export Logs",
|
||||
));
|
||||
}
|
||||
await logsFile.copy(filePath);
|
||||
}
|
||||
|
||||
Future<String> getAbbreviatedLogs() async {
|
||||
|
|
Loading…
Reference in a new issue