mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Surface persistence and fetch errors instead of swallowing them
PrefUtil.setValue now returns the underlying SharedPreferences result and throws on unsupported types; settings save reports failures rather than always showing success. Device detail and event history report the real Dio error message and skip cancellations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
f7f255e20f
commit
e70676a193
@@ -1,3 +1,4 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
@@ -98,8 +99,9 @@ class _DeviceEventHistoryState extends State<DeviceEventHistory> {
|
||||
});
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
setState(() {
|
||||
_error = e.toString();
|
||||
_error = dioErrorToUserMessage(e);
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
@@ -115,9 +117,9 @@ class _DeviceEventHistoryState extends State<DeviceEventHistory> {
|
||||
}
|
||||
|
||||
if (_error != null) {
|
||||
return const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Center(child: Text('Failed to load event history')),
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: Center(child: Text('Failed to load event history: $_error')),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user