From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 2816F1FF141 for ; Tue, 02 Jun 2026 10:49:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9BABE823B; Tue, 2 Jun 2026 10:49:08 +0200 (CEST) Message-ID: Date: Tue, 2 Jun 2026 10:48:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH proxmox_dart_api_client 2/2] deps: add objective_c dependency to access NSError's code property To: Shan Shaji , pve-devel@lists.proxmox.com References: <20260410150935.25870-1-s.shaji@proxmox.com> <20260410150935.25870-8-s.shaji@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20260410150935.25870-8-s.shaji@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1780390108745 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.049 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: FFOAALL4KBJR2F3G7RHYOQSFDU25R2RD X-Message-ID-Hash: FFOAALL4KBJR2F3G7RHYOQSFDU25R2RD X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: the actual changes look ok, but you mixed in whitespace changes, which makes it harder to see what was actually the intended patch please send whitespace changes as a separate patch On 4/10/26 5:09 PM, Shan Shaji wrote: > Starting from `v9.0.0` of the `objective_c` package, `NSError` is defined > as an extension type [0] instead of a wrapper class in Dart. As a result, the > `code` property is not accessible at compile time unless the extension > type is explicitly imported, even though the underlying object exposes > it at runtime. > > To fix this, the `objective_c` dependency has been added and imported the > dependency were the code property is accessed. > > - [0] https://github.com/dart-lang/native/pull/2723 > > Signed-off-by: Shan Shaji > --- > lib/src/authenticate.dart | 15 ++++++--------- > pubspec.lock | 2 +- > pubspec.yaml | 1 + > 3 files changed, 8 insertions(+), 10 deletions(-) > > diff --git a/lib/src/authenticate.dart b/lib/src/authenticate.dart > index 4c9ae22..203c165 100644 > --- a/lib/src/authenticate.dart > +++ b/lib/src/authenticate.dart > @@ -7,6 +7,7 @@ import 'package:http/http.dart' as http; > import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart'; > import 'package:proxmox_dart_api_client/src/handle_ticket_response.dart'; > import 'package:proxmox_dart_api_client/src/models/serializers.dart'; > +import 'package:objective_c/objective_c.dart'; > > /// Returns an authenticated client to work with if successful. > /// > @@ -38,10 +39,7 @@ Future authenticate( > print("retrying for backward compat!"); > final errors = jsonDecode(response.body)['errors'] ?? {}; > if (errors.containsKey('new-format')) { > - var body = { > - 'username': username, > - 'password': password, > - }; > + var body = {'username': username, 'password': password}; > response = await httpClient > .post(credentials.ticketUrl, body: body) > .timeout(Duration(seconds: 25)); > @@ -50,13 +48,12 @@ Future authenticate( > > credentials = handleAccessTicketResponse(response, credentials); > > - return ProxmoxApiClient( > - credentials, > - httpClient: httpClient, > - ); > + return ProxmoxApiClient(credentials, httpClient: httpClient); > } on TimeoutException catch (_) { > throw ProxmoxApiException( > - 'Authentication takes unusually long, check network connection', 408); > + 'Authentication takes unusually long, check network connection', > + 408, > + ); > } on NSErrorClientException catch (e) { > // Treat untrusted server certificate (-1202) as a handshake failure. > if (e.error.code == -1202) { > diff --git a/pubspec.lock b/pubspec.lock > index 66aa9b8..ffdf790 100644 > --- a/pubspec.lock > +++ b/pubspec.lock > @@ -375,7 +375,7 @@ packages: > source: hosted > version: "2.0.2" > objective_c: > - dependency: transitive > + dependency: "direct main" > description: > name: objective_c > sha256: "100a1c87616ab6ed41ec263b083c0ef3261ee6cd1dc3b0f35f8ddfa4f996fe52" > diff --git a/pubspec.yaml b/pubspec.yaml > index 9094c4d..a3426cc 100644 > --- a/pubspec.yaml > +++ b/pubspec.yaml > @@ -12,6 +12,7 @@ dependencies: > retry: ^3.1.0 > cronet_http: ^1.5.0 > cupertino_http: ^2.3.0 > + objective_c: ^9.3.0 > > dev_dependencies: > lints: ^6.0.0