1 | <?php |
||
23 | class ErrorPlugin implements Plugin |
||
24 | { |
||
25 | /** |
||
26 | * @var string[] |
||
27 | */ |
||
28 | private static $errors = [ |
||
29 | 'ERROR' => ServerErrorException::class, |
||
30 | 'INVALID_REQUEST' => ClientErrorException::class, |
||
31 | 'MAX_DIMENSIONS_EXCEEDED' => ClientErrorException::class, |
||
32 | 'MAX_ELEMENTS_EXCEEDED' => ClientErrorException::class, |
||
33 | 'MAX_WAYPOINTS_EXCEEDED' => ClientErrorException::class, |
||
34 | 'NOT_FOUND' => ClientErrorException::class, |
||
35 | 'OVER_QUERY_LIMIT' => ServerErrorException::class, |
||
36 | 'REQUEST_DENIED' => ClientErrorException::class, |
||
37 | 'UNKNOWN_ERROR' => ServerErrorException::class, |
||
38 | ]; |
||
39 | |||
40 | private static $placeholders = [ |
||
41 | '"status" : "%s"', |
||
42 | '<status>%s</status>', |
||
43 | ]; |
||
44 | |||
45 | public function handleRequest(RequestInterface $request, callable $next, callable $first) |
||
51 | |||
52 | protected function transformResponseToException(RequestInterface $request, ResponseInterface $response): ResponseInterface |
||
70 | } |
||
71 |