Skip to content

Commit

Permalink
Implement UserPreferencesNotFound exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed Jan 15, 2012
1 parent 8d57247 commit 379160e
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/UserPreferencesNotFound.php
@@ -0,0 +1,13 @@
<?php
namespace MantisBT\Exception\User;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class UserPreferencesNotFound extends ExceptionAbstract {
public function __construct() {
$errorMessage = lang_get(ERROR_USER_PREFS_NOT_FOUND, null, false);
parent::__construct(ERROR_USER_PREFS_NOT_FOUND, $errorMessage, null);
$this->responseCode = 500;
}
}
3 changes: 2 additions & 1 deletion application/core/user_pref_api.php
Expand Up @@ -34,6 +34,7 @@
*/

use MantisBT\Exception\Database\ColumnNotFound;
use MantisBT\Exception\User\UserPreferencesNotFound;

require_api( 'authentication_api.php' );
require_api( 'config_api.php' );
Expand Down Expand Up @@ -192,7 +193,7 @@ function user_pref_cache_row( $p_user_id, $p_project_id = ALL_PROJECTS, $p_trigg

if( !$row ) {
if( $p_trigger_errors ) {
trigger_error( ERROR_USER_PREFS_NOT_FOUND, ERROR );
throw new UserPreferencesNotFound();
} else {
$g_cache_user_pref[(int)$p_user_id][(int)$p_project_id] = false;
return false;
Expand Down

0 comments on commit 379160e

Please sign in to comment.