Updated: Parsing error catched and logged

This commit is contained in:
Muhammed Ayimen 2023-11-16 15:38:42 +09:00
parent 3455e7f7c3
commit 9d73a39b9d
2 changed files with 11 additions and 2 deletions

View file

@ -398,5 +398,6 @@
"iOSOkButton": "OK",
"@iOSOkButton": {
"description": "Message showed on a button that the user can click to leave the current dialog. It is used on iOS side. Maximum 30 characters."
}
},
"parsingErrorText": "Error while parsing Google Auth QR code"
}

View file

@ -11,6 +11,7 @@ import 'package:ente_auth/utils/toast_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:logging/logging.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
@ -81,7 +82,14 @@ class _QrScannerState extends State<QrScanner> {
scannerController.dispose();
Navigator.of(context).pop(codes);
} catch (e) {
debugPrint('Error occurred while parsing: $e');
showToast(context, l10n.parsingErrorText);
Logger("Code parsing error").severe(
"Error while parsing Google Auth QR code",
e,
);
throw Exception(
'Failed to parse Google Auth QR code \n ${e.toString()}',
);
}
} else {
showToast(context, l10n.invalidQrCodeText);