Use more granular exceptions and error messages in important modules

This commit is contained in:
Kijin Sung 2018-09-06 10:11:05 +09:00
parent 10c8d11785
commit 08964804be
6 changed files with 13 additions and 13 deletions

View file

@ -461,7 +461,7 @@ class boardController extends board
$parent_comment = $oCommentModel->getComment($obj->parent_srl);
if(!$parent_comment->comment_srl)
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
if($parent_comment->isSecret() && $this->module_info->secret === 'Y')
{
@ -662,7 +662,7 @@ class boardController extends board
$oComment = $oCommentModel->getComment($comment_srl);
if(!$oComment->isExists())
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
// compare the comment password and the user input password
@ -678,7 +678,7 @@ class boardController extends board
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists())
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
// compare the document password and the user input password

View file

@ -262,7 +262,7 @@ class boardView extends board
// if the module srl is not consistent
if($oDocument->get('module_srl')!=$this->module_info->module_srl )
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
// check the manage grant
@ -690,7 +690,7 @@ class boardView extends board
$oDocument = getModel('document')->getDocument($document_srl);
if(!$oDocument->isExists())
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
Context::set('oDocument', $oDocument);

View file

@ -53,7 +53,7 @@ class commentController extends comment
$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
if($comment_config->use_vote_up == 'N')
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
}
$point = 1;
@ -123,7 +123,7 @@ class commentController extends comment
$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
if($comment_config->use_vote_down == 'N')
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
}
$point = -1;

View file

@ -82,7 +82,7 @@ class commentView extends comment
$oComment = $oCommentModel->getComment($comment_srl);
if(!$oComment->isExists())
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
// Check permissions
if(!$oComment->isAccessible())

View file

@ -42,7 +42,7 @@ class documentController extends document
$oModuleModel = getModel('module');
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
if($document_config->use_vote_up=='N') throw new Rhymix\Framework\Exceptions\InvalidRequest;
if($document_config->use_vote_up=='N') throw new Rhymix\Framework\Exceptions\FeatureDisabled;
$point = 1;
$output = $this->updateVotedCount($document_srl, $point);
@ -128,7 +128,7 @@ class documentController extends document
$oModuleModel = getModel('module');
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
if($document_config->use_vote_down=='N') throw new Rhymix\Framework\Exceptions\InvalidRequest;
if($document_config->use_vote_down=='N') throw new Rhymix\Framework\Exceptions\FeatureDisabled;
$point = -1;
$output = $this->updateVotedCount($document_srl, $point);

View file

@ -36,7 +36,7 @@ class documentView extends document
$oDocumentModel = getModel('document');
// Creates an object for displaying the selected document
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
if(!$oDocument->isExists()) throw new Rhymix\Framework\Exceptions\InvalidRequest;
if(!$oDocument->isExists()) throw new Rhymix\Framework\Exceptions\TargetNotFound;
// Check permissions
if(!$oDocument->isAccessible()) throw new Rhymix\Framework\Exceptions\NotPermitted;
// Information setting module
@ -58,7 +58,7 @@ class documentView extends document
{
if(!checkCSRF())
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\SecurityViolation;
}
$content = Context::get('content');
@ -218,7 +218,7 @@ class documentView extends document
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager, FALSE);
if(!$oDocument->isExists())
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
// Check permissions
if(!$oDocument->isAccessible())