diff --git a/lib/repositories/ios_speech_recognizer.dart b/lib/repositories/ios_speech_recognizer.dart index 14bb20a..cb28b9c 100644 --- a/lib/repositories/ios_speech_recognizer.dart +++ b/lib/repositories/ios_speech_recognizer.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:flutter/services.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; const iosPlatform = MethodChannel("voiceoutliner.saga.chat/iostx"); @@ -13,8 +14,9 @@ Future recognizeNoteIOS(String path, String locale) async { } else { return null; } - } catch (err) { + } catch (err, tr) { print(err); + Sentry.captureException(err, stackTrace: tr); return null; } } @@ -42,8 +44,8 @@ Future> getLocaleOptions() async { try { final res = await iosPlatform.invokeMethod("getLocaleOptions"); return Map.from(res); - } catch (err) { - print(err); + } catch (err, tr) { + Sentry.captureException(err, stackTrace: tr); return {}; } } diff --git a/lib/repositories/vosk_speech_recognizer.dart b/lib/repositories/vosk_speech_recognizer.dart index 6dd701d..b44bc13 100644 --- a/lib/repositories/vosk_speech_recognizer.dart +++ b/lib/repositories/vosk_speech_recognizer.dart @@ -4,6 +4,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_archive/flutter_archive.dart'; import 'package:flutter_sound/flutter_sound.dart'; import 'package:path_provider/path_provider.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:voice_outliner/consts.dart'; @@ -50,7 +51,8 @@ Future voskSpeechRecognize(String path) async { final result = await androidPlatform.invokeMethod("transcribe", {"path": outPath}); return result; - } catch (err) { + } catch (err, tr) { + Sentry.captureException(err, stackTrace: tr); print(err); return null; } @@ -68,8 +70,9 @@ Future voskInitModel(String path) async { return res.toString(); } return null; - } catch (e) { - return e.toString(); + } catch (err, tr) { + Sentry.captureException(err, stackTrace: tr); + return err.toString(); } } @@ -103,7 +106,8 @@ Future voskDownloadAndInitModel(String url) async { final sharedPreferences = await SharedPreferences.getInstance(); await sharedPreferences.setString(modelDirKey, modelDir.path); return null; - } catch (err) { + } catch (err, tr) { + Sentry.captureException(err, stackTrace: tr); return err.toString(); } } diff --git a/pubspec.yaml b/pubspec.yaml index c5f8e67..3f5f49e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.22.2+91 +version: 1.22.3+92 environment: sdk: ">=2.12.0 <3.0.0"