* [pve-devel] [PATCH dart_api_client 1/1] change exception toString to only print details if not null
@ 2025-05-05 7:28 Michael Köppl
2025-05-05 15:44 ` Shan Shaji
2025-05-21 11:04 ` Dominik Csapak
0 siblings, 2 replies; 4+ messages in thread
From: Michael Köppl @ 2025-05-05 7:28 UTC (permalink / raw)
To: pve-devel
Without this check, the toString method returns '-> null' at the end of
the exception message if there are no details.
Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
lib/src/proxmox_api_exception.dart | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/src/proxmox_api_exception.dart b/lib/src/proxmox_api_exception.dart
index 8dddc7c..5c6f343 100644
--- a/lib/src/proxmox_api_exception.dart
+++ b/lib/src/proxmox_api_exception.dart
@@ -7,6 +7,6 @@ class ProxmoxApiException implements Exception {
@override
String toString() {
- return '$message -> $details';
+ return details != null ? '$message -> $details' : message;
}
}
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pve-devel] [PATCH dart_api_client 1/1] change exception toString to only print details if not null
2025-05-05 7:28 [pve-devel] [PATCH dart_api_client 1/1] change exception toString to only print details if not null Michael Köppl
@ 2025-05-05 15:44 ` Shan Shaji
2025-05-21 11:04 ` Dominik Csapak
1 sibling, 0 replies; 4+ messages in thread
From: Shan Shaji @ 2025-05-05 15:44 UTC (permalink / raw)
To: Proxmox VE development discussion
On Mon May 5, 2025 at 9:28 AM CEST, Michael Köppl wrote:
> Without this check, the toString method returns '-> null' at the end of
> the exception message if there are no details.
>
> Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
The change looks good to me. Please consider this change.
Reviewed-By: Shan Shaji <s.shaji@proxmox.com>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pve-devel] [PATCH dart_api_client 1/1] change exception toString to only print details if not null
2025-05-05 7:28 [pve-devel] [PATCH dart_api_client 1/1] change exception toString to only print details if not null Michael Köppl
2025-05-05 15:44 ` Shan Shaji
@ 2025-05-21 11:04 ` Dominik Csapak
2025-05-23 7:51 ` Michael Köppl
1 sibling, 1 reply; 4+ messages in thread
From: Dominik Csapak @ 2025-05-21 11:04 UTC (permalink / raw)
To: Proxmox VE development discussion, Michael Köppl
patch looks good to me, but do you remember where you encountered this?
would make the commit message a bit better if we know how we could trigger
this (especially when trying to test this ;) )
If you want i can fix up the commit message with an example on applying
On 5/5/25 09:28, Michael Köppl wrote:
> Without this check, the toString method returns '-> null' at the end of
> the exception message if there are no details.
>
> Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
> ---
> lib/src/proxmox_api_exception.dart | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/src/proxmox_api_exception.dart b/lib/src/proxmox_api_exception.dart
> index 8dddc7c..5c6f343 100644
> --- a/lib/src/proxmox_api_exception.dart
> +++ b/lib/src/proxmox_api_exception.dart
> @@ -7,6 +7,6 @@ class ProxmoxApiException implements Exception {
>
> @override
> String toString() {
> - return '$message -> $details';
> + return details != null ? '$message -> $details' : message;
> }
> }
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pve-devel] [PATCH dart_api_client 1/1] change exception toString to only print details if not null
2025-05-21 11:04 ` Dominik Csapak
@ 2025-05-23 7:51 ` Michael Köppl
0 siblings, 0 replies; 4+ messages in thread
From: Michael Köppl @ 2025-05-23 7:51 UTC (permalink / raw)
To: Dominik Csapak, Proxmox VE development discussion
Thanks for having a look at this. I did not encounter this in the app.
The places where I could have, avoid this by either printing `e.message`
directly or simply throwing. This patch was a reaction to [0], where
"Host unreachable, possibly offline. -> null" would have been printed if
the the error had been wrapped in a ProxmoxApiException. Of course you
could just throw and avoid this altogether, but I think consistently
wrapping errors in ProxmoxApiException makes sense if we wanted to make
changes to error messages in the future and still keep things
consistent. Also, since `details` is defined as `Map<String, dynamic>?`,
I figured it might as well be treated as possibly null as there are
cases where there are no details (e.g. authentication timeout).
[0]
https://lore.proxmox.com/pve-devel/680650ab-aa4b-4cc7-8d2b-69516ffabef6@proxmox.com/
On 5/21/25 13:04, Dominik Csapak wrote:
> patch looks good to me, but do you remember where you encountered this?
> would make the commit message a bit better if we know how we could trigger
> this (especially when trying to test this ;) )
>
> If you want i can fix up the commit message with an example on applying
>
> On 5/5/25 09:28, Michael Köppl wrote:
>> Without this check, the toString method returns '-> null' at the end of
>> the exception message if there are no details.
>>
>> Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
>> ---
>> lib/src/proxmox_api_exception.dart | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/src/proxmox_api_exception.dart b/lib/src/
>> proxmox_api_exception.dart
>> index 8dddc7c..5c6f343 100644
>> --- a/lib/src/proxmox_api_exception.dart
>> +++ b/lib/src/proxmox_api_exception.dart
>> @@ -7,6 +7,6 @@ class ProxmoxApiException implements Exception {
>> @override
>> String toString() {
>> - return '$message -> $details';
>> + return details != null ? '$message -> $details' : message;
>> }
>> }
>
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-23 7:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-05 7:28 [pve-devel] [PATCH dart_api_client 1/1] change exception toString to only print details if not null Michael Köppl
2025-05-05 15:44 ` Shan Shaji
2025-05-21 11:04 ` Dominik Csapak
2025-05-23 7:51 ` Michael Köppl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal