Exception handling for getSku.
This commit is contained in:
parent
9a1c5c9c03
commit
4fb7933e34
1 changed files with 5 additions and 4 deletions
|
|
@ -173,9 +173,10 @@ Returns an instanciated WebGUI::Asset::Sku object for this cart item.
|
|||
|
||||
sub getSku {
|
||||
my ($self) = @_;
|
||||
my $asset = '';
|
||||
$asset = WebGUI::Asset->newById($self->cart->session, $self->get("assetId"));
|
||||
$asset->applyOptions($self->get("options")) if $asset;
|
||||
my $asset = eval { WebGUI::Asset->newById($self->cart->session, $self->get("assetId")); };
|
||||
if (!Exception::Class->caught) {
|
||||
$asset->applyOptions($self->get("options"));
|
||||
}
|
||||
return $asset;
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +230,7 @@ Removes this item from the cart and calls $sku->onRemoveFromCart. See also delet
|
|||
|
||||
sub remove {
|
||||
my $self = shift;
|
||||
my $sku = $self->getSku;
|
||||
my $sku = eval { $self->getSku; };
|
||||
$sku->onRemoveFromCart($self) if $sku;
|
||||
return $self->delete;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue