diff --git a/src/Util/Exception/ClientException.php b/src/Util/Exception/ClientException.php
index 31e8dde84b..cd318f16e2 100644
--- a/src/Util/Exception/ClientException.php
+++ b/src/Util/Exception/ClientException.php
@@ -17,10 +17,6 @@
// along with GNU social. If not, see .
// }}}
-namespace App\Util\Exception;
-
-use Exception;
-
/**
* Client exception. Indicates a client request contains some sort of
* error. HTTP code 400
@@ -31,17 +27,22 @@ use Exception;
* @author Evan Prodromou
* @copyright 2009 StatusNet Inc.
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
+ * @author Alexei Sorokin
* @author Hugo Sales
- * @copyright 2018-2020 Free Software Foundation, Inc http://www.fsf.org
+ * @copyright 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 Exception;
+
class ClientException extends Exception
{
- public function __construct(string $message = null, int $code = 400)
+ public function __construct(string $message = '', int $code = 500, Throwable $previous = null)
{
- parent::__construct($message, $code);
+ parent::__construct($message, $code, $previous);
}
-
public function __toString()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
diff --git a/src/Util/Exception/ServerException.php b/src/Util/Exception/ServerException.php
new file mode 100644
index 0000000000..25d798c982
--- /dev/null
+++ b/src/Util/Exception/ServerException.php
@@ -0,0 +1,54 @@
+.
+
+// }}}
+
+/**
+ * Class for server exceptions
+ *
+ * Subclass of PHP Exception for server errors.
+ * The user typically can't fix these.
+ *
+ * @category Exception
+ * @package GNUsocial
+ *
+ * @author Evan Prodromou
+ * @copyright 2008-2010 StatusNet, Inc.
+ * @author Alexei Sorokin
+ * @author Hugo Sales
+ * @copyright 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 Exception;
+
+class ServerException extends Exception
+{
+ public function __construct(string $message = '', int $code = 500, Throwable $previous = null)
+ {
+ parent::__construct($message, $code, $previous);
+ }
+
+ public function __toString()
+ {
+ return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
+ }
+}