Paws::EC2::DescribeVolumes fails with perl error when non existent VolumeIds is specified
When something like:
$ec2->DescribeVolumes(VolumeIds => [ $snapshot->'VolumeId' ])
is executed with a non existent 'VolumeId' the code stops with perl error and aborting execution.
One would expect a 'undefined' result, not a perl error and stopping the execution.
Hi,
This behaviour is by design :( The AWS API communicates the failure to find a volume with an HTTP error, that gets transformed to an exeption by Paws.
You can do something like
my $res = eval { $ec2->DescribeVolumes(...) };
To get the behaviour your looking for. Note that with this code ANY (even unrelated to the volume not existing) exception will be caught. If you want to treat the exception, remember that Paws throws exception objects with a code attribute that you can normally compare to see if it's the exception you were expecting.