[pve-devel] [PATCH pve-flutter-frontend 3/9] node overview: don't throw permission errors on every update
Dominik Csapak
d.csapak at proxmox.com
Fri Apr 12 10:04:52 CEST 2024
getting the apt update status requires Sys.Modify, but the user does not
necessarily has that. So instead of showing a pop up every 10 seconds,
simply ignore permission errors and only show other exceptions here.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
lib/bloc/pve_node_overview_bloc.dart | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/bloc/pve_node_overview_bloc.dart b/lib/bloc/pve_node_overview_bloc.dart
index 7a093b0..caeb1c4 100644
--- a/lib/bloc/pve_node_overview_bloc.dart
+++ b/lib/bloc/pve_node_overview_bloc.dart
@@ -40,8 +40,15 @@ class PveNodeOverviewBloc
yield latestState.rebuild((b) => b..rrdData.replace(rrdData));
final services = await apiClient.getNodeServices(nodeID);
yield latestState.rebuild((b) => b..services.replace(services));
- final updates = await apiClient.getNodeAptUpdate(nodeID);
- yield latestState.rebuild((b) => b..updates.replace(updates));
+ try {
+ final updates = await apiClient.getNodeAptUpdate(nodeID);
+ yield latestState.rebuild((b) => b..updates.replace(updates));
+ } on ProxmoxApiException catch (e) {
+ // only throw on non permission related errors
+ if (e.statusCode != 403) {
+ rethrow;
+ }
+ }
final disks = await apiClient.getNodeDisksList(nodeID);
yield latestState.rebuild((b) => b..disks.replace(disks));
}
--
2.39.2
More information about the pve-devel
mailing list