1<?php
2
3/**
4 * Exception which will show a 400 Bad Request error page.
5 *
6 * This exception can be thrown from within an module page handler. The user will then be
7 * shown a 400 Bad Request error page.
8 *
9 * @author Olav Morken, UNINETT AS.
10 * @package SimpleSAMLphp
11 */
12class SimpleSAML_Error_BadRequest extends SimpleSAML_Error_Error
13{
14
15
16    /**
17     * Reason why this request was invalid.
18     */
19    private $reason;
20
21
22    /**
23     * Create a new BadRequest error.
24     *
25     * @param string $reason  Description of why the request was unacceptable.
26     */
27    public function __construct($reason)
28    {
29        assert(is_string($reason));
30
31        $this->reason = $reason;
32        parent::__construct(array('BADREQUEST', '%REASON%' => $this->reason));
33        $this->httpCode = 400;
34    }
35
36
37    /**
38     * Retrieve the reason why the request was invalid.
39     *
40     * @return string  The reason why the request was invalid.
41     */
42    public function getReason()
43    {
44        return $this->reason;
45    }
46}
47