Skip to content

Commit

Permalink
Implement UserProfileNotFound exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed Dec 18, 2011
1 parent 3cfb608 commit ec16120
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions application/MantisBT/Exception/User/UserProfileNotFound.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
namespace MantisBT\Exception\User;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class UserProfileNotFound extends ExceptionAbstract {
public function __construct() {
$errorMessage = lang_get(ERROR_USER_PROFILE_NOT_FOUND, null, false);
parent::__construct(ERROR_USER_PROFILE_NOT_FOUND, $errorMessage, null);
$this->responseCode = 500;
}
}
3 changes: 2 additions & 1 deletion application/core/user_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

use MantisBT\Exception\Database\ColumnNotFound;
use MantisBT\Exception\User\UserNameNotUnique;
use MantisBT\Exception\User\UserProfileNotFound;

require_api( 'access_api.php' );
require_api( 'authentication_api.php' );
Expand Down Expand Up @@ -1102,7 +1103,7 @@ function user_get_profile_row( $p_user_id, $p_profile_id ) {

$row = db_fetch_array( $result );
if( !$row ) {
trigger_error( ERROR_USER_PROFILE_NOT_FOUND, ERROR );
throw new UserProfileNotFound();
}

return $row;
Expand Down

0 comments on commit ec16120

Please sign in to comment.