Ostatus_profile throws NoProfileException from localProfile()
Some implementations of the exception handling is included here, the actions come in a later commit.
This commit is contained in:
@@ -31,13 +31,22 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
|
||||
$feedsub = new FeedSub();
|
||||
$feedsub->find();
|
||||
while ($feedsub->fetch()) {
|
||||
echo "{$feedsub->uri} ({$feedsub->sub_state})";
|
||||
try {
|
||||
echo $feedsub->getUri() . " ({$feedsub->sub_state})";
|
||||
if ($feedsub->garbageCollect()) {
|
||||
echo " INACTIVE\n";
|
||||
} else {
|
||||
echo " ACTIVE\n";
|
||||
}
|
||||
} catch (NoProfileException $e) {
|
||||
echo " DELETED (no profile)\n";
|
||||
$feedsub->delete();
|
||||
continue;
|
||||
} catch (NoUriException $e) {
|
||||
// Probably the getUri() call
|
||||
echo "[unknown] DELETED (no uri)\n";
|
||||
$feedsub->delete();
|
||||
continue;
|
||||
} catch (Exception $e) {
|
||||
echo " ERROR: {$e->getMessage()}\n";
|
||||
}
|
||||
|
@@ -38,13 +38,17 @@ END_OF_HELP;
|
||||
|
||||
require_once INSTALLDIR.'/scripts/commandline.inc';
|
||||
|
||||
function showProfileInfo($oprofile) {
|
||||
function showProfileInfo(Ostatus_profile $oprofile) {
|
||||
if ($oprofile->isGroup()) {
|
||||
echo "group\n";
|
||||
} else {
|
||||
$profile = $oprofile->localProfile();
|
||||
foreach (array('nickname', 'bio', 'homepage', 'location') as $field) {
|
||||
print " $field: {$profile->$field}\n";
|
||||
try {
|
||||
foreach (array('nickname', 'bio', 'homepage', 'location') as $field) {
|
||||
print " $field: {$profile->$field}\n";
|
||||
}
|
||||
} catch (NoProfileException $e) {
|
||||
print "local profile not found";
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
|
Reference in New Issue
Block a user