]> git.proxmox.com Git - flutter/pve_flutter_frontend.git/commitdiff
node overview: don't throw permission errors on every update
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 12 Apr 2024 08:04:52 +0000 (10:04 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 15 Apr 2024 09:22:27 +0000 (11:22 +0200)
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@proxmox.com>
lib/bloc/pve_node_overview_bloc.dart

index 7a093b0e0a3555971939932faf6c2299427acb1f..caeb1c43acaca696472c502324e7e331fdf039a4 100644 (file)
@@ -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));
     }