summaryrefslogtreecommitdiffstats
path: root/apps/contacts/ajax/contact/delete.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/contacts/ajax/contact/delete.php')
-rw-r--r--apps/contacts/ajax/contact/delete.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/contacts/ajax/contact/delete.php b/apps/contacts/ajax/contact/delete.php
index def98b36705..e73f34f898d 100644
--- a/apps/contacts/ajax/contact/delete.php
+++ b/apps/contacts/ajax/contact/delete.php
@@ -4,6 +4,7 @@
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
+ * @copyright 2012 Thomas Tanghus (thomas@tanghus.net)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -30,7 +31,14 @@ $id = isset($_POST['id'])?$_POST['id']:null;
if(!$id) {
bailOut(OC_Contacts_App::$l10n->t('id is not set.'));
}
-$card = OC_Contacts_App::getContactObject( $id );
-OC_Contacts_VCard::delete($id);
+try {
+ OC_Contacts_VCard::delete($id);
+} catch(Exception $e) {
+ $msg = $e->getMessage();
+ OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$msg,
+ OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts', __METHOD__.', id'.$id, OCP\Util::DEBUG);
+ bailOut($msg);
+}
OCP\JSON::success(array('data' => array( 'id' => $id )));