|
|
@@ -36,7 +36,7 @@ trait ViewVarsTrait {
|
|
|
*
|
|
|
* @param string $viewClass View class name or null to use $viewClass
|
|
|
* @return \Cake\View\View
|
|
|
- * @throws \RuntimeException If view class was not found.
|
|
|
+ * @throws \Cake\View\Exception\MissingViewException If view class was not found.
|
|
|
*/
|
|
|
public function getView($viewClass = null) {
|
|
|
if ($viewClass === null && $this->View) {
|
|
|
@@ -59,7 +59,7 @@ trait ViewVarsTrait {
|
|
|
$this->viewClass = $viewClass;
|
|
|
$className = App::className($this->viewClass, 'View', 'View');
|
|
|
if (!$className) {
|
|
|
- throw new \RuntimeException(sprintf('View class "%s" was not found.', $viewClass));
|
|
|
+ throw new Exception\MissingViewException([$viewClass]);
|
|
|
}
|
|
|
|
|
|
if ($this->View && $this->View instanceof $className) {
|
|
|
@@ -74,7 +74,7 @@ trait ViewVarsTrait {
|
|
|
*
|
|
|
* @param string $viewClass Optional namespaced class name of the View class to instantiate.
|
|
|
* @return \Cake\View\View
|
|
|
- * @throws \RuntimeException If view class was not found.
|
|
|
+ * @throws \Cake\View\Exception\MissingViewException If view class was not found.
|
|
|
*/
|
|
|
public function createView($viewClass = null) {
|
|
|
if ($viewClass === null) {
|
|
|
@@ -86,7 +86,7 @@ trait ViewVarsTrait {
|
|
|
$className = App::className($viewClass, 'View', 'View');
|
|
|
}
|
|
|
if (!$className) {
|
|
|
- throw new \RuntimeException(sprintf('View class "%s" was not found.', $viewClass));
|
|
|
+ throw new Exception\MissingViewException([$viewClass]);
|
|
|
}
|
|
|
$viewOptions = array_intersect_key(get_object_vars($this), array_flip($this->_validViewOptions));
|
|
|
return new $className($this->request, $this->response, $this->eventManager(), $viewOptions);
|