Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
AjaxResponse | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
send | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | /** |
4 | * Created by PhpStorm. |
5 | * User: chris |
6 | * Date: 15/07/16 |
7 | * Time: 10:58 |
8 | */ |
9 | |
10 | namespace oat\tao\model\mvc\error; |
11 | |
12 | class AjaxResponse extends ResponseAbstract |
13 | { |
14 | protected $contentType = 'application/json'; |
15 | |
16 | public function send() |
17 | { |
18 | |
19 | $message = $this->exception->getMessage(); |
20 | if (method_exists($this->exception, 'getUserMessage')) { |
21 | $message = $this->exception->getUserMessage(); |
22 | } |
23 | |
24 | $response = [ |
25 | "success" => false, |
26 | "type" => 'Exception', |
27 | "data" => [ |
28 | 'ExceptionType' => get_class($this->exception) |
29 | ], |
30 | "message" => $message, |
31 | ]; |
32 | new \common_AjaxResponse($response); |
33 | } |
34 | } |