aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/restapi/RouterException.php
blob: 53fd3628040a89fa4f55f404a9fcb8cbee4bf10f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);
    }
}