ApplicationException.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2015 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\presentation;
12 
16 
17 /**
18  * ApplicationException signals a general application exception.
19  *
20  * @author ingo herwig <ingo@wemove.com>
21  */
22 class ApplicationException extends \Exception {
23 
24  private $_request = null;
25  private $_response = null;
26  private $_error = null;
27 
28  /**
29  * Constructor
30  * @param $request The current request
31  * @param $response The current response
32  * @param $error An ApplicationError instance
33  */
34  public function __construct(Request $request, Response $response,
35  ApplicationError $error) {
36 
37  $this->_request = $request;
38  $this->_response = $response;
39  $this->_error = $error;
40 
41  parent::__construct($error->getMessage());
42  }
43 
44  /**
45  * Get the current request
46  * @return The Request instance
47  */
48  public function getRequest() {
49  return $this->_request;
50  }
51 
52  /**
53  * Get the current response
54  * @return The Response instance
55  */
56  public function getResponse() {
57  return $this->_response;
58  }
59 
60  /**
61  * Get the error
62  * @return The ApplicationError instance
63  */
64  public function getError() {
65  return $this->_error;
66  }
67 }
68 ?>
Response holds the response values that are used as output from Controller instances.
Definition: Response.php:20
Presentation related interfaces and classes.
Definition: namespaces.php:59
Request holds the request values that are used as input to Controller instances.
Definition: Request.php:20
__construct(Request $request, Response $response, ApplicationError $error)
Constructor.
ApplicationError is used to signal errors that occur while processing a request.
ApplicationException signals a general application exception.