1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Contacts: Some Exceptions weren't namspaced.

This commit is contained in:
Thomas Tanghus 2013-03-12 22:14:05 +01:00
parent afa0c40917
commit ccc32aac25
3 changed files with 17 additions and 17 deletions

View File

@ -137,7 +137,7 @@ class Addressbook {
\OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR); \OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
return false; return false;
} }
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__.', exception: ' . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__.', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('contacts', __METHOD__.', id: ' . $id, \OCP\Util::DEBUG); \OCP\Util::writeLog('contacts', __METHOD__.', id: ' . $id, \OCP\Util::DEBUG);
return false; return false;
@ -147,7 +147,7 @@ class Addressbook {
if($row['userid'] != \OCP\USER::getUser() && !\OC_Group::inGroup(\OCP\User::getUser(), 'admin')) { if($row['userid'] != \OCP\USER::getUser() && !\OC_Group::inGroup(\OCP\User::getUser(), 'admin')) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $id); $sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $id);
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_READ)) { if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_READ)) {
throw new Exception( throw new \Exception(
App::$l10n->t( App::$l10n->t(
'You do not have the permissions to read this addressbook.' 'You do not have the permissions to read this addressbook.'
) )
@ -190,7 +190,7 @@ class Addressbook {
\OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR); \OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
return false; return false;
} }
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__ . ' exception: ' . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__ . ' exception: ' . $e->getMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('contacts', __METHOD__ . ' uid: ' . $uid, \OCP\Util::DEBUG); \OCP\Util::writeLog('contacts', __METHOD__ . ' uid: ' . $uid, \OCP\Util::DEBUG);
return false; return false;
@ -208,7 +208,7 @@ class Addressbook {
\OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR); \OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
return false; return false;
} }
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('contacts', __METHOD__.', uid: '.$uid, \OCP\Util::DEBUG); \OCP\Util::writeLog('contacts', __METHOD__.', uid: '.$uid, \OCP\Util::DEBUG);
return false; return false;
@ -236,7 +236,7 @@ class Addressbook {
\OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR); \OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
return false; return false;
} }
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__.', exception: ' . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__.', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('contacts', __METHOD__.', uid: ' . $uid, \OCP\Util::DEBUG); \OCP\Util::writeLog('contacts', __METHOD__.', uid: ' . $uid, \OCP\Util::DEBUG);
\OCP\Util::writeLog('contacts', __METHOD__.', uri: ' . $uri, \OCP\Util::DEBUG); \OCP\Util::writeLog('contacts', __METHOD__.', uri: ' . $uri, \OCP\Util::DEBUG);
@ -278,16 +278,16 @@ class Addressbook {
$result = $stmt->execute(array($name,$description,$id)); $result = $stmt->execute(array($name,$description,$id));
if (\OC_DB::isError($result)) { if (\OC_DB::isError($result)) {
\OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR); \OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
throw new Exception( throw new \Exception(
App::$l10n->t( App::$l10n->t(
'There was an error updating the addressbook.' 'There was an error updating the addressbook.'
) )
); );
} }
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('contacts', __METHOD__ . ', id: ' . $id, \OCP\Util::DEBUG); \OCP\Util::writeLog('contacts', __METHOD__ . ', id: ' . $id, \OCP\Util::DEBUG);
throw new Exception( throw new \Exception(
App::$l10n->t( App::$l10n->t(
'There was an error updating the addressbook.' 'There was an error updating the addressbook.'
) )
@ -332,7 +332,7 @@ class Addressbook {
} }
$row = $result->fetchRow(); $row = $result->fetchRow();
return (bool)$row['active']; return (bool)$row['active'];
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__.', exception: ' . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__.', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
return false; return false;
} }
@ -349,7 +349,7 @@ class Addressbook {
if ($addressbook['userid'] != \OCP\User::getUser() && !\OC_Group::inGroup(\OCP\User::getUser(), 'admin')) { if ($addressbook['userid'] != \OCP\User::getUser() && !\OC_Group::inGroup(\OCP\User::getUser(), 'admin')) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $id); $sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $id);
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_DELETE)) { if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_DELETE)) {
throw new Exception( throw new \Exception(
App::$l10n->t( App::$l10n->t(
'You do not have the permissions to delete this addressbook.' 'You do not have the permissions to delete this addressbook.'
) )
@ -362,7 +362,7 @@ class Addressbook {
foreach($cards as $card) { foreach($cards as $card) {
try { try {
VCard::delete($card['id']); VCard::delete($card['id']);
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', \OCP\Util::writeLog('contacts',
__METHOD__.', exception deleting vCard '.$card['id'].': ' __METHOD__.', exception deleting vCard '.$card['id'].': '
. $e->getMessage(), . $e->getMessage(),
@ -378,7 +378,7 @@ class Addressbook {
__METHOD__.', exception for ' . $id . ': ' __METHOD__.', exception for ' . $id . ': '
. $e->getMessage(), . $e->getMessage(),
\OCP\Util::ERROR); \OCP\Util::ERROR);
throw new Exception( throw new \Exception(
App::$l10n->t( App::$l10n->t(
'There was an error deleting this addressbook.' 'There was an error deleting this addressbook.'
) )

View File

@ -49,13 +49,13 @@ class App {
$vcard = null; $vcard = null;
try { try {
$card = VCard::find($id); $card = VCard::find($id);
} catch(Exception $e) { } catch(\Exception $e) {
return null; return null;
} }
try { try {
$vcard = \Sabre\VObject\Reader::read($card['carddata']); $vcard = \Sabre\VObject\Reader::read($card['carddata']);
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__.', exception: ' . $e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__.', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('contacts', __METHOD__.', id: ' . $id, \OCP\Util::DEBUG); \OCP\Util::writeLog('contacts', __METHOD__.', id: ' . $id, \OCP\Util::DEBUG);
return null; return null;

View File

@ -212,7 +212,7 @@ class VCard {
\OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
return false; return false;
} }
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('contacts', __METHOD__.', aid: '.$aid.' uid'.$uid, \OCP\Util::DEBUG); \OCP\Util::writeLog('contacts', __METHOD__.', aid: '.$aid.' uid'.$uid, \OCP\Util::DEBUG);
return false; return false;
@ -437,7 +437,7 @@ class VCard {
\OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR); \OC_Log::write('contacts', __METHOD__. 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
} }
//OCP\Util::writeLog('contacts','OCA\Contacts\VCard::updateDataByID, id: '.$object[0].': '.$object[1],OCP\Util::DEBUG); //OCP\Util::writeLog('contacts','OCA\Contacts\VCard::updateDataByID, id: '.$object[0].': '.$object[1],OCP\Util::DEBUG);
} catch(Exception $e) { } catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('contacts', __METHOD__.', id: '.$object[0], \OCP\Util::DEBUG); \OCP\Util::writeLog('contacts', __METHOD__.', id: '.$object[0], \OCP\Util::DEBUG);
} }
@ -652,7 +652,7 @@ class VCard {
$id = $contact['id']; $id = $contact['id'];
try { try {
return self::delete($id); return self::delete($id);
} catch (Exception $e) { } catch (\Exception $e) {
switch($e->getCode()) { switch($e->getCode()) {
case 403: case 403:
\OCP\Util::writeLog('contacts', __METHOD__.', forbidden: ' \OCP\Util::writeLog('contacts', __METHOD__.', forbidden: '