Normalised custom exception usage in user classes.

Also updated the Index library to include the MediaType fix.
This commit is contained in:
flash 2023-07-22 15:02:45 +00:00
parent 6414d1290a
commit 20c528a88c
36 changed files with 128 additions and 194 deletions
public

View file

@ -1,10 +1,9 @@
<?php
namespace Misuzu;
use RuntimeException;
use Misuzu\Users\User;
use Misuzu\Users\UserNotFoundException;
use Misuzu\Users\UserSession;
use Misuzu\Users\UserSessionNotFoundException;
require_once __DIR__ . '/../misuzu.php';
@ -118,7 +117,7 @@ if($authToken->isValid()) {
try {
$userInfo = User::byId($authToken->getImpersonatedUserId());
} catch(UserNotFoundException $ex) {
} catch(RuntimeException $ex) {
$userInfo = $userInfoReal;
$authToken->removeImpersonatedUserId();
$authToken->applyCookie();
@ -128,10 +127,7 @@ if($authToken->isValid()) {
}
}
}
} catch(UserNotFoundException $ex) {
UserSession::unsetCurrent();
User::unsetCurrent();
} catch(UserSessionNotFoundException $ex) {
} catch(RuntimeException $ex) {
UserSession::unsetCurrent();
User::unsetCurrent();
}