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

@ -27,10 +27,10 @@ class documentAdminController extends document
{
// error appears if no doc is selected
$cart = Context::get('cart');
if(!$cart) return $this->stop('msg_cart_is_null');
if(!$cart) throw new Rhymix\Framework\Exception('msg_cart_is_null');
$document_srl_list= explode('|@|', $cart);
$document_count = count($document_srl_list);
if(!$document_count) return $this->stop('msg_cart_is_null');
if(!$document_count) throw new Rhymix\Framework\Exception('msg_cart_is_null');
// Delete a doc
$oDocumentController = getController('document');
for($i=0;$i<$document_count;$i++)
@ -314,7 +314,10 @@ class documentAdminController extends document
$oDocumentModel = getModel('document');
$oDocumentController = getController('document');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
if(!$oDocument->isGranted())
{
throw new Rhymix\Framework\Exceptions\NotPermitted;
}
$oMemberModel = getModel('member');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl'));

View file

@ -172,7 +172,10 @@ class documentView extends document
$oMemberModel = getModel('member');
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
if(!$oMemberModel->isLogged())
{
throw new Rhymix\Framework\Exceptions\MustLogin;
}
// Get the saved document (module_srl is set to member_srl instead)
$logged_info = Context::get('logged_info');
$args = new stdClass();