Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

private/rest/classes/controllers/error.php
Go to the documentation of this file.
1 <?php
15 class ezpRestErrorController extends ezcMvcController
16 {
21 public function doShow()
22 {
23 if ( ($this->exception instanceof ezcMvcRouteNotFoundException) || ($this->exception instanceof ezpContentNotFoundException ) )
24 {
25 // we want to return a 404 to the user
26 $result = new ezcMvcResult;
27 $result->status = new ezpRestHttpResponse( ezpHttpResponseCodes::NOT_FOUND, "Not Found" );
28 return $result;
29 }
30
31 else if ( $this->exception instanceof ezpOauthBadRequestException )
32 {
33 $result = new ezcMvcResult;
34 $result->status = new ezpRestOauthErrorStatus( $this->exception->errorType, $this->exception->getMessage() );
35 $result->variables['message'] = $this->exception->getMessage();
36 return $result;
37 }
38 else if ( $this->exception instanceof ezpOauthRequiredException )
39 {
40 $result = new ezcMvcResult;
41 $result->status = new ezpOauthRequired( "Exponential REST", $this->exception->errorType, $this->exception->getMessage() );
42 $result->variables['message'] = $this->exception->getMessage();
43 return $result;
44 }
45 else if ( $this->exception instanceof ezpContentAccessDeniedException )
46 {
47 $result = new ezcMvcResult;
48 $result->variables['message'] = $this->exception->getMessage();
49 $result->status = new ezpRestHttpResponse( ezpHttpResponseCodes::FORBIDDEN, $this->exception->getMessage() );
50 return $result;
51 }
52 else if ( $this->exception instanceof ezpRouteMethodNotAllowedException )
53 {
54 $result = new ezpRestMvcResult;
55 $result->status = new ezpRestStatusResponse(
56 ezpHttpResponseCodes::METHOD_NOT_ALLOWED,
57 $this->exception->getMessage(),
58 array( 'Allow' => implode( ', ', $this->exception->getAllowedMethods() ) )
59 );
60 return $result;
61 }
62
63 $result = new ezcMvcResult;
64 $result->variables['message'] = $this->exception->getMessage();
65 $result->status = new ezpRestHttpResponse( ezpHttpResponseCodes::SERVER_ERROR, $this->exception->getMessage() );
66 return $result;
67 }
68 }
69 ?>
ezpContentAccessDeniedException
Definition: access_denied.php:13
ezpContentNotFoundException
Definition: content_not_found.php:13
ezpHttpResponseCodes\NOT_FOUND
const NOT_FOUND
Definition: http_response_codes.php:18
ezpHttpResponseCodes\METHOD_NOT_ALLOWED
const METHOD_NOT_ALLOWED
Definition: http_response_codes.php:19
ezpHttpResponseCodes\SERVER_ERROR
const SERVER_ERROR
Definition: http_response_codes.php:20
ezpHttpResponseCodes\FORBIDDEN
const FORBIDDEN
Definition: http_response_codes.php:17
ezpOauthBadRequestException
Definition: bad_request.php:18
ezpOauthRequiredException
Definition: exceptions/auth.php:18
ezpOauthRequired
Definition: oauth_required.php:16
ezpRestErrorController
Definition: private/rest/classes/controllers/error.php:16
ezpRestErrorController\doShow
doShow()
Definition: private/rest/classes/controllers/error.php:21
ezpRestHttpResponse
Definition: http_response.php:13
ezpRestMvcResult
Definition: private/rest/classes/response/result.php:16
ezpRestOauthErrorStatus
Definition: oauth_error.php:13
ezpRestStatusResponse
Definition: response.php:13
ezpRouteMethodNotAllowedException
Definition: route_method_not_allowed.php:13
$result
$result
Definition: companysearch.php:94
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.