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; $options['uri'] = $nb->uri;
} }
$saved = Notice::saveNew($profile->id, try {
$content, $saved = Notice::saveNew($profile->id,
array_key_exists('source', $options) ? $content,
$options['source'] : 'web', array_key_exists('source', $options) ?
$options); $options['source'] : 'web',
$options);
} catch (Exception $e) {
$nb->delete();
throw $e;
}
if (empty($saved)) {
$nb->delete();
}
return $saved; return $saved;
} }