From: "Michael Köppl" <m.koeppl@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Alexander Abraham <a.abraham@proxmox.com>
Subject: Re: [pve-devel] [PATCH dart_api_client 1/1] fix #4976: Request errors are
Date: Fri, 2 May 2025 12:19:14 +0200 [thread overview]
Message-ID: <680650ab-aa4b-4cc7-8d2b-69516ffabef6@proxmox.com> (raw)
In-Reply-To: <20250429131645.106612-2-a.abraham@proxmox.com>
Hi, thanks for tackling this. Noticed a few small things. Find the
comments inline. Generally, please run dart format on these changes.
Every changed block contains wrong indentation. Also, the commit message
needs to be fixed.
On 4/29/25 15:16, Alexander Abraham wrote:
> This commit adds more explicit error-handling for when a host
> is possibly offline.
>
> Signed-off-by: Alexander Abraham <a.abraham@proxmox.com>
> ---
> lib/src/client.dart | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/lib/src/client.dart b/lib/src/client.dart
> index f597c28..7c118d8 100644
> --- a/lib/src/client.dart
> +++ b/lib/src/client.dart
> @@ -1,6 +1,5 @@
> import 'dart:convert';
> import 'dart:io';
> -
> import 'package:http/http.dart' as http;
> //import 'package:proxmox_dart_api_client/src/models/pve_access_user_model.dart';
> import 'package:proxmox_dart_api_client/src/models/pve_models.dart';
> @@ -127,7 +126,7 @@ class ProxmoxApiClient extends http.BaseClient {
> () => get(url),
> retryIf: (e) => e is http.ClientException || e is SocketException,
> ))
> - .validate(extensiveResponseValidation);
> + .validate(extensiveResponseValidation);
> }
>
> Future<http.Response> _postWithValidation(
> @@ -398,9 +397,14 @@ class ProxmoxApiClient extends http.BaseClient {
> 'typefilter': typefilter,
> 'userfilter': userfilter
> };
> - final response = await _getWithValidation(path, queryParameters);
> + var response;
> + try {
> + response = await _getWithValidation(path, queryParameters);
> + }
> + catch(e) {
> + throw "Host unreachable, possibly offline.";
Is there a reason this is not wrapped in a ProxmoxApiException? If the
reason is that it then displays "Host unreachable, possibly offline. ->
null", I think it would generally be a good idea to adapt
ProxmoxApiException's toString method to account for the details
possibly being null.
nit: Since this is not a sentence, I think it should either be "Host is
unreachable, possibly offline" or not end with a dot.
> + }
> final decoded = json.decode(response.body);
> -
> var data = (decoded['data'] as List).map((f) {
> return serializers.deserializeWith(PveClusterTasksModel.serializer, f);
> });
> @@ -563,7 +567,7 @@ class ProxmoxApiClient extends http.BaseClient {
> var data = (json.decode(response.body)['data'] as List).map((f) {
> return serializers.deserializeWith(PveNodeRRDDataModel.serializer, f);
> });
> - return data.whereType<PveNodeRRDDataModel>().toList();
> + return data.whereType<PveNodeRRDDataModel>().toList();
> }
>
> Future<List<PveNodeServicesModel>> getNodeServices(
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-05-02 10:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 13:16 [pve-devel] [PATCH proxmox_dart_api_client/pve_flutter_frontend_null 0/2] fix #4976 Alexander Abraham
2025-04-29 13:16 ` [pve-devel] [PATCH dart_api_client 1/1] fix #4976: Request errors are Alexander Abraham
2025-05-02 10:19 ` Michael Köppl [this message]
2025-05-05 13:03 ` Michael Köppl
2025-04-29 13:16 ` [pve-devel] [PATCH flutter_frontend 1/1] fix #4976: ui: Nodes offline Alexander Abraham
2025-05-02 11:32 ` Michael Köppl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=680650ab-aa4b-4cc7-8d2b-69516ffabef6@proxmox.com \
--to=m.koeppl@proxmox.com \
--cc=a.abraham@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal