Am 15.11.23 um 10:37 schrieb Philipp Hufnagl:
> 
> 
> On 11/15/23 09:31, Fiona Ebner wrote:
>> Am 14.11.23 um 15:27 schrieb Philipp Hufnagl:
>>> @@ -826,10 +837,18 @@ sub activate_storage {
>>>      die "$storeid: $@" if $@;
>>>  
>>>      my $datastore = $scfg->{datastore};
>>> +    my $namespace = $scfg->{namespace};
>>>  
>>>      for my $ds (@$datastores) {
>>>     if ($ds->{store} eq $datastore) {
>>> -       return 1;
>>> +       return 1 if !defined($namespace);
>>> +       my $namespaces = eval { scan_namespaces($scfg, $datastore, 
>>> $password) };
>>
>> Why use eval and ignore the error here? Like that users (and we) won't
>> know if the api request or connection failed and just get the error
>> message from below about permissions/existence then.
> 
> I tried to mimic the behavior from scan_datastores(). Did I make a
> mistake there? Is the way of scan_datastores() deprecated or bad practice?
>>

There, the error is not ignored, but propagated:

>     my $datastores = eval { scan_datastores($scfg, $password) };
>     die "$storeid: $@" if $@;


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to