Commit 5f77d18b authored by Penny Leach's avatar Penny Leach

changed the exception handling stuff a lot. adding new exception types

has a bit more overhead now but they're handled much nicer. Exception
and MaharaException should now NEVER be thrown directly
parent 59844ee8
......@@ -32,7 +32,7 @@ require(get_config('docroot') . 'auth/user.php');
/**
* Unknown user exception
*/
class AuthUnknownUserException extends Exception {}
class AuthUnknownUserException extends UserException {}
/**
* Base authentication class. Provides a common interface with which
......
......@@ -26,9 +26,6 @@
defined('INTERNAL') || die();
/** Thrown if the key requested doesn't exist */
class UserKeyInvalidException extends Exception {}
/**
* The user class represents a single logged in user in the system. The user
* has several properties that can be accessed and set, including account
......@@ -88,7 +85,7 @@ class User {
*/
public function get($key) {
if (!isset($this->defaults[$key])) {
throw new UserKeyInvalidException($key);
throw new InvalidArgumentException($key);
}
if (null !== ($value = $this->SESSION->get("user/$key"))) {
return $value;
......@@ -101,7 +98,7 @@ class User {
*/
public function set($key, $value) {
if (!isset($this->defaults[$key])) {
throw new UserKeyInvalidException($key);
throw new InvalidArgumentException($key);
}
$this->SESSION->set("user/$key", $value);
}
......
......@@ -54,4 +54,7 @@ $string['unrecoverableerrortitle'] = '%s - Site Unavailable';
$string['parameterexception'] = 'A required parameter was missing';
$string['accessdeniedexception'] = 'You do not have access to view this page';
?>
$string['viewnotfoundexceptiontitle'] = 'View not found';
$string['viewnotfoundexceptionmessage'] = 'You tried to access a view that didn\'t exist!';
?>
\ No newline at end of file
This diff is collapsed.
......@@ -29,7 +29,7 @@ defined('INTERNAL') || die();
/**
* Class to use for installation exceptions
*/
class InstallationException extends Exception {}
class InstallationException extends SystemException {}
/**
......
......@@ -7,6 +7,7 @@
<div class="content">
<div class="box-cnrs"><span class="cnr-tl"><span class="cnr-tr"><span class="cnr-bl"><span class="cnr-br">
<div class="maincontent">
<h4>{$title}</h4>
{$message}
</div>
</span></span></span></span></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment