mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
Wrap sending error file in try/catch for unexpected behaviors [skip ci]
This commit is contained in:
parent
fcde1bd7b6
commit
d79b481d3e
1 changed files with 21 additions and 18 deletions
|
@ -172,8 +172,9 @@ void _saveException(String? error, StackTrace? stackTrace) async {
|
|||
}
|
||||
};
|
||||
|
||||
String separator = "\n\n==========================================================" +
|
||||
"\n==========================================================\n\n";
|
||||
const String separator =
|
||||
'''\n\n==========================================================
|
||||
==========================================================\n\n''';
|
||||
|
||||
await file.writeAsString(
|
||||
jsonEncode(exception) + separator,
|
||||
|
@ -182,12 +183,11 @@ void _saveException(String? error, StackTrace? stackTrace) async {
|
|||
}
|
||||
|
||||
void _sendExceptionFile() async {
|
||||
try {
|
||||
final appDocDir = await getApplicationDocumentsDirectory();
|
||||
|
||||
final file = File('${appDocDir.path}/error.txt');
|
||||
|
||||
print(file.readAsStringSync());
|
||||
|
||||
final MailOptions mailOptions = MailOptions(
|
||||
subject: 'Mobile App Issue',
|
||||
recipients: ['support@cakewallet.com'],
|
||||
|
@ -203,6 +203,9 @@ void _sendExceptionFile() async {
|
|||
result.name == MailerResponse.android.name) {
|
||||
file.writeAsString("", mode: FileMode.write);
|
||||
}
|
||||
} catch (e, s) {
|
||||
_saveException(e.toString(), s);
|
||||
}
|
||||
}
|
||||
|
||||
void _onError(FlutterErrorDetails errorDetails) {
|
||||
|
|
Loading…
Reference in a new issue