Replace $this->stop() with proper exceptions

This commit is contained in:
Kijin Sung 2018-09-06 00:19:47 +09:00
parent 5b7ce90a3d
commit d8a0773b97
26 changed files with 109 additions and 69 deletions

View file

@ -23,7 +23,7 @@ class layoutAdminController extends layout
*/
function procLayoutAdminInsert()
{
if(Context::get('layout') == 'faceoff') return $this->stop('not supported');
if(Context::get('layout') == 'faceoff') throw new Rhymix\Framework\Exception('not supported');
// Get information to create a layout
$site_module_info = Context::get('site_module_info');
@ -683,7 +683,7 @@ class layoutAdminController extends layout
*/
function procLayoutAdminUserLayoutImport()
{
return $this->stop('not supported');
throw new Rhymix\Framework\Exception('not supported');
// check upload
if(!Context::isUploaded()) exit();
@ -713,12 +713,12 @@ class layoutAdminController extends layout
$sourceArgs = Context::getRequestVars();
if($sourceArgs->layout == 'faceoff')
{
return $this->stop('not supported');
throw new Rhymix\Framework\Exception('not supported');
}
if(!$sourceArgs->layout_srl)
{
return $this->stop('msg_empty_origin_layout');
throw new Rhymix\Framework\Exception('msg_empty_origin_layout');
}
$oLayoutModel = getModel('layout');
@ -731,7 +731,7 @@ class layoutAdminController extends layout
if(!is_array($sourceArgs->title) || count($sourceArgs->title) == 0)
{
return $this->stop('msg_empty_target_layout');
throw new Rhymix\Framework\Exception('msg_empty_target_layout');
}
$output = $oLayoutModel->getLayoutRawData($sourceArgs->layout_srl, array('extra_vars'));

View file

@ -67,7 +67,7 @@ class layoutAdminModel extends layout
// Error appears if there is no layout information is registered
if(!$layout_info)
{
return $this->stop('msg_invalid_request');
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
// Get a menu list

View file

@ -140,11 +140,11 @@ class layoutAdminView extends layout
$layout = Context::get('layout');
if(!in_array($type, array('P', 'M'))) $type = 'P';
if(!$layout) return $this->stop('msg_invalid_request');
if(!$layout) throw new Rhymix\Framework\Exceptions\InvalidRequest;
$oLayoutModel = getModel('layout');
$layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
if(!$layout_info) return $this->stop('msg_invalid_request');
if(!$layout_info) throw new Rhymix\Framework\Exceptions\InvalidRequest;
Context::set('layout_info', $layout_info);
@ -175,10 +175,10 @@ class layoutAdminView extends layout
// Get layout info
$layout = Context::get('layout');
if($layout == 'faceoff') return $this->stop('not supported');
if($layout == 'faceoff') throw new Rhymix\Framework\Exception('not supported');
$layout_info = $oModel->getLayoutInfo($layout, null, $type);
if(!$layout_info) return $this->stop('msg_invalid_request');
if(!$layout_info) throw new Rhymix\Framework\Exceptions\InvalidRequest;
// get Menu list
$oMenuAdminModel = getAdminModel('menu');