Skip to content

Commit

Permalink
Implement TagNotAttached exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed Feb 25, 2012
1 parent a6d8300 commit 1ed28c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 13 additions & 0 deletions application/MantisBT/Exception/Issue/Tag/TagNotAttached.php
@@ -0,0 +1,13 @@
<?php
namespace MantisBT\Exception\Issue\Tag;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class TagNotAttached extends ExceptionAbstract {
public function __construct() {
$errorMessage = lang_get(ERROR_TAG_NOT_ATTACHED, null, false);
parent::__construct(ERROR_TAG_NOT_ATTACHED, $errorMessage, null);
$this->responseCode = 400;
}
}
5 changes: 3 additions & 2 deletions application/core/tag_api.php
Expand Up @@ -40,6 +40,7 @@

use MantisBT\Exception\Database\ColumnNotFound;
use MantisBT\Exception\Issue\Tag\TagAlreadyAttached;
use MantisBT\Exception\Issue\Tag\TagNotAttached;
use MantisBT\Exception\Tag\TagNameInvalid;
use MantisBT\Exception\Tag\TagNameNotUnique;
use MantisBT\Exception\Tag\TagNotFound;
Expand Down Expand Up @@ -535,7 +536,7 @@ function tag_bug_get_row( $p_tag_id, $p_bug_id ) {

$t_row = db_fetch_array( $result );
if( !$t_row ) {
trigger_error( TAG_NOT_ATTACHED, ERROR );
throw new TagNotAttached();
}
return $t_row;
}
Expand Down Expand Up @@ -646,7 +647,7 @@ function tag_bug_detach( $p_tag_id, $p_bug_id, $p_add_history = true, $p_user_id
}

if( !tag_bug_is_attached( $p_tag_id, $p_bug_id ) ) {
trigger_error( TAG_NOT_ATTACHED, ERROR );
throw new TagNotAttached();
}

$t_tag_row = tag_bug_get_row( $p_tag_id, $p_bug_id);
Expand Down

0 comments on commit 1ed28c2

Please sign in to comment.