Add glitchtip for centralized error logging

This commit is contained in:
2026-07-30 02:32:30 +02:00
parent 498ad68e1c
commit c210f80f27
15 changed files with 416 additions and 193 deletions
+6 -8
View File
@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:kooltab2/utils/app_update_util.dart';
import 'package:ota_update/ota_update.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'app_config.dart';
@@ -86,34 +87,31 @@ Future<void> _downloadAndInstall(UpdateInfo update) async {
)
.listen((OtaEvent event) {
debugPrint("OTA status: ${event.status}");
debugPrint("OTA value: ${event.value}");
switch (event.status) {
case OtaStatus.DOWNLOADING:
final progress = double.tryParse(event.value ?? "0") ?? 0;
debugPrint("Downloading ${progress.toStringAsFixed(0)}%");
break;
case OtaStatus.INSTALLING:
debugPrint("Installing update");
break;
case OtaStatus.INSTALLATION_ERROR:
debugPrint("Installation error: ${event.value}");
break;
case OtaStatus.DOWNLOAD_ERROR:
debugPrint("Download error: ${event.value}");
break;
default:
break;
}
}, onError: (e, stack) {
debugPrint("OTA stream error: $e");
Sentry.captureException(e, stackTrace: stack);
});
} catch (e) {
} catch (e, stack) {
debugPrint("OTA update failed: $e");
Sentry.captureException(e, stackTrace: stack);
}
}