mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Improved InvalidToken handling for #1653
This commit is contained in:
parent
7f64dee54b
commit
288ff23f2b
|
@ -10,9 +10,9 @@ const getURL = (add = '') => serverRequest('Json') + pString(add),
|
|||
checkResponseError = data => {
|
||||
const err = data ? data.ErrorCode : null;
|
||||
if (Notifications.InvalidToken === err) {
|
||||
console.error(getNotification(err));
|
||||
console.error(getNotification(err) + ` (${data.ErrorMessageAdditional})`);
|
||||
// alert(getNotification(err));
|
||||
rl.logoutReload();
|
||||
setTimeout(rl.logoutReload, 5000);
|
||||
} else if ([
|
||||
Notifications.AuthError,
|
||||
Notifications.ConnectionError,
|
||||
|
|
|
@ -15,9 +15,11 @@ class ClientException extends \RuntimeException
|
|||
|
||||
public function __construct(int $iCode, ?\Throwable $oPrevious = null, string $sAdditionalMessage = '')
|
||||
{
|
||||
parent::__construct(\RainLoop\Notifications::GetNotificationsMessage($iCode, $oPrevious),
|
||||
$iCode, $oPrevious);
|
||||
|
||||
parent::__construct(
|
||||
\RainLoop\Notifications::GetNotificationsMessage($iCode, $oPrevious),
|
||||
$iCode,
|
||||
$oPrevious
|
||||
);
|
||||
$this->sAdditionalMessage = $sAdditionalMessage ?: ($oPrevious ? $oPrevious->getMessage() : '');
|
||||
}
|
||||
|
||||
|
@ -25,4 +27,13 @@ class ClientException extends \RuntimeException
|
|||
{
|
||||
return $this->sAdditionalMessage;
|
||||
}
|
||||
|
||||
public function __toString() : string
|
||||
{
|
||||
$message = $this->getMessage();
|
||||
if ($this->sAdditionalMessage) {
|
||||
$message .= " ({$this->sAdditionalMessage})";
|
||||
}
|
||||
return "{$message}\r\n{$this->getFile()}#{$this->getLine()}\r\n{$this->getTraceAsString()}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,9 +149,9 @@ class ServiceActions
|
|||
}
|
||||
catch (\Throwable $oException)
|
||||
{
|
||||
\SnappyMail\Log::warning('SERVICE', "{$oException->getMessage()}\r\n{$oException->getTraceAsString()}");
|
||||
\SnappyMail\Log::warning('SERVICE', "{$oException}");
|
||||
if ($e = $oException->getPrevious()) {
|
||||
\SnappyMail\Log::warning('SERVICE', "- {$e->getMessage()} @ {$e->getFile()}#{$e->getLine()}");
|
||||
\SnappyMail\Log::warning('SERVICE', "- {$e}");
|
||||
}
|
||||
|
||||
$aResponse = $this->oActions->ExceptionResponse($oException);
|
||||
|
|
Loading…
Reference in a new issue