delete the Bookmark if Notice::saveNew() fails

This commit is contained in:
Evan Prodromou 2011-04-01 09:30:25 -04:00
parent d5a38c62f4
commit a84d584971

View File

@ -329,11 +329,20 @@ class Bookmark extends Memcached_DataObject
$options['uri'] = $nb->uri;
}
try {
$saved = Notice::saveNew($profile->id,
$content,
array_key_exists('source', $options) ?
$options['source'] : 'web',
$options);
} catch (Exception $e) {
$nb->delete();
throw $e;
}
if (empty($saved)) {
$nb->delete();
}
return $saved;
}