aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/restapi/RouterException.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:07:19 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:19:12 +0200
commita3da1483a9e689846179159355badfec8073dbec (patch)
tree770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /lib/classes/restapi/RouterException.php
current code from svn, revision 62608
Diffstat (limited to 'lib/classes/restapi/RouterException.php')
-rw-r--r--lib/classes/restapi/RouterException.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/classes/restapi/RouterException.php b/lib/classes/restapi/RouterException.php
new file mode 100644
index 0000000..53fd362
--- /dev/null
+++ b/lib/classes/restapi/RouterException.php
@@ -0,0 +1,31 @@
+<?php
+namespace RESTAPI;
+use \Exception;
+
+/**
+ * Router exception.
+ *
+ * @author Jan-Hendrik Willms <tleilax+studip@gmail.com>
+ * @author <mlunzena@uos.de>
+ * @license GPL 2 or later
+ * @since Stud.IP 3.0
+ * @deprecated Since Stud.IP 5.0. Will be removed in Stud.IP 5.2.
+ */
+class RouterException extends Exception
+{
+ protected static $error_messages = [
+ 400 => 'Bad Request',
+ 401 => 'Unauthorized',
+ 403 => 'Forbidden',
+ 404 => 'Not Found',
+ 405 => 'Method Not Allowed',
+ 500 => 'Internal Server Error',
+ 501 => 'Not implemented',
+ ];
+
+ public function __construct($code = 500, $message = '', $previous = null)
+ {
+ $message = $message ?: self::$error_messages[$code] ?: '';
+ parent::__construct($message, $code, $previous);
+ }
+}