Catch exceptions when making assets to commit.

This commit is contained in:
Colin Kuskie 2010-04-06 18:49:10 -07:00
parent e03fdef2bb
commit 54ea1f66e1

View file

@ -309,13 +309,13 @@ sub getAssets {
$pending = " and assetData.status='pending' "; $pending = " and assetData.status='pending' ";
} }
my $sth = $self->session->db->read("select asset.assetId,assetData.revisionDate from assetData left join asset on asset.assetId=assetData.assetId where assetData.tagId=? ".$pending." order by ".$sort." ".$direction, [$self->getId]); my $sth = $self->session->db->read("select asset.assetId,assetData.revisionDate from assetData left join asset on asset.assetId=assetData.assetId where assetData.tagId=? ".$pending." order by ".$sort." ".$direction, [$self->getId]);
while (my ($id,$version) = $sth->array) { ASSETID: while (my ($id,$version) = $sth->array) {
my $asset = WebGUI::Asset->newById($self->session,$id,$version); my $asset = eval { WebGUI::Asset->newById($self->session,$id,$version); };
unless (defined $asset) { unless (defined $asset) {
$self->session->errorHandler->error("Asset $id $version could not be instanciated by version tag ".$self->getId.". Perhaps it is corrupt."); $self->session->errorHandler->error("Asset $id $version could not be instanciated by version tag ".$self->getId.". Perhaps it is corrupt.");
next; next ASSETID;
} }
push(@assets, $asset); push(@assets, $asset);
} }
return \@assets; return \@assets;
} }