diff --git a/src/Util/Common.php b/src/Util/Common.php
index af0bf3dc98..1feb7ee490 100644
--- a/src/Util/Common.php
+++ b/src/Util/Common.php
@@ -37,6 +37,7 @@ use App\Core\Router\Router;
use App\Core\Security;
use App\Entity\GSActor;
use App\Entity\LocalUser;
+use App\Util\Exception\NoLoggedInUser;
use Exception;
use Functional as F;
diff --git a/src/Util/Exception/ClientException.php b/src/Util/Exception/ClientException.php
index cd318f16e2..713186884f 100644
--- a/src/Util/Exception/ClientException.php
+++ b/src/Util/Exception/ClientException.php
@@ -35,6 +35,7 @@
namespace App\Util\Exception;
+use function App\Core\I18n\_m;
use Exception;
class ClientException extends Exception
@@ -45,6 +46,6 @@ class ClientException extends Exception
}
public function __toString()
{
- return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
+ return __CLASS__ . " [{$this->code}]: " . _m($this->message) . "\n";
}
}
diff --git a/src/Util/Exception/NicknameEmptyException.php b/src/Util/Exception/NicknameEmptyException.php
index 0cd7f80528..a5e3bc89c8 100644
--- a/src/Util/Exception/NicknameEmptyException.php
+++ b/src/Util/Exception/NicknameEmptyException.php
@@ -17,8 +17,6 @@
// along with GNU social. If not, see .
// }}}
-namespace App\Util\Exception;
-
/**
* Nickname empty exception
*
@@ -38,6 +36,11 @@ namespace App\Util\Exception;
* @copyright 2018-2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
+
+namespace App\Util\Exception;
+
+use function App\Core\I18n\_m;
+
class NicknameEmptyException extends NicknameInvalidException
{
protected function defaultMessage(): string
diff --git a/src/Util/Exception/NicknameException.php b/src/Util/Exception/NicknameException.php
index 4fdda6801f..4ca7b85400 100644
--- a/src/Util/Exception/NicknameException.php
+++ b/src/Util/Exception/NicknameException.php
@@ -17,8 +17,6 @@
// along with GNU social. If not, see .
// }}}
-namespace App\Util\Exception;
-
/**
* Nickname empty exception
*
@@ -38,6 +36,9 @@ namespace App\Util\Exception;
* @copyright 2018-2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
+
+namespace App\Util\Exception;
+
class NicknameException extends ClientException
{
public function __construct(string $msg = null, int $code = 400)
diff --git a/src/Util/Exception/NicknameInvalidException.php b/src/Util/Exception/NicknameInvalidException.php
index 7058c48400..df1d6b7ced 100644
--- a/src/Util/Exception/NicknameInvalidException.php
+++ b/src/Util/Exception/NicknameInvalidException.php
@@ -17,8 +17,6 @@
// along with GNU social. If not, see .
// }}}
-namespace App\Util\Exception;
-
/**
* Nickname invalid exception
*
@@ -38,6 +36,11 @@ namespace App\Util\Exception;
* @copyright 2018-2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
+
+namespace App\Util\Exception;
+
+use function App\Core\I18n\_m;
+
class NicknameInvalidException extends NicknameException
{
protected function defaultMessage(): string
diff --git a/src/Util/Exception/NicknameReservedException.php b/src/Util/Exception/NicknameReservedException.php
index d4ac30c753..96eb351fe8 100644
--- a/src/Util/Exception/NicknameReservedException.php
+++ b/src/Util/Exception/NicknameReservedException.php
@@ -17,8 +17,6 @@
// along with GNU social. If not, see .
// }}}
-namespace App\Util\Exception;
-
/**
* Nickname reserved exception
*
@@ -38,6 +36,11 @@ namespace App\Util\Exception;
* @copyright 2018-2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
+
+namespace App\Util\Exception;
+
+use function App\Core\I18n\_m;
+
class NicknameReservedException extends NicknameException
{
protected function defaultMessage(): string
diff --git a/src/Util/Exception/NicknameTakenException.php b/src/Util/Exception/NicknameTakenException.php
index 02243a3a1b..f588752055 100644
--- a/src/Util/Exception/NicknameTakenException.php
+++ b/src/Util/Exception/NicknameTakenException.php
@@ -19,8 +19,6 @@
// }}}
-namespace App\Util\Exception;
-
/**
* Nickname empty exception
*
@@ -40,6 +38,11 @@ namespace App\Util\Exception;
* @copyright 2018-2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
+
+namespace App\Util\Exception;
+
+use function App\Core\I18n\_m;
+
class NicknameTakenException extends NicknameException
{
public ?Profile $profile = null; // the Profile which occupies the nickname
diff --git a/src/Util/Exception/NicknameTooLongException.php b/src/Util/Exception/NicknameTooLongException.php
index 8b83e4b22d..705ba68cae 100644
--- a/src/Util/Exception/NicknameTooLongException.php
+++ b/src/Util/Exception/NicknameTooLongException.php
@@ -19,10 +19,6 @@
// }}}
-namespace App\Util\Exception;
-
-use App\Util\Nickname;
-
/**
* Nickname too long exception
*
@@ -42,6 +38,12 @@ use App\Util\Nickname;
* @copyright 2018-2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
+
+namespace App\Util\Exception;
+
+use function App\Core\I18n\_m;
+use App\Util\Nickname;
+
class NicknameTooLongException extends NicknameInvalidException
{
protected function defaultMessage(): string
diff --git a/src/Util/Exception/NoLoggedInUser.php b/src/Util/Exception/NoLoggedInUser.php
index 492b8df070..aa4546238f 100644
--- a/src/Util/Exception/NoLoggedInUser.php
+++ b/src/Util/Exception/NoLoggedInUser.php
@@ -29,6 +29,6 @@ namespace App\Util\Exception;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
-class NoLoggedInUser extends NicknameInvalidException
+class NoLoggedInUser extends ClientException
{
}
diff --git a/src/Util/Exception/ServerException.php b/src/Util/Exception/ServerException.php
index 25d798c982..3e6b1f1fab 100644
--- a/src/Util/Exception/ServerException.php
+++ b/src/Util/Exception/ServerException.php
@@ -38,6 +38,7 @@
namespace App\Util\Exception;
+use function App\Core\I18n\_m;
use Exception;
class ServerException extends Exception
@@ -49,6 +50,6 @@ class ServerException extends Exception
public function __toString()
{
- return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
+ return __CLASS__ . " [{$this->code}]: " . _m($this->message) . "\n";
}
}