← Back to team overview

anewt-developers team mailing list archive

[Branch ~uws/anewt/anewt.uws] Rev 1751: [config] Throw error when accessing key that does not exist

 

------------------------------------------------------------
revno: 1751
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt.uws
timestamp: Tue 2010-02-16 00:45:17 +0100
message:
  [config] Throw error when accessing key that does not exist
  
  ...instead of just asserting this doesn't happen.
modified:
  config/config.lib.php


--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws

Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription.
=== modified file 'config/config.lib.php'
--- config/config.lib.php	2008-11-13 17:19:33 +0000
+++ config/config.lib.php	2010-02-15 23:45:17 +0000
@@ -38,7 +38,11 @@
 	public static function get($name)
 	{
 		assert('is_string($name)');
-		assert('AnewtConfig::is_set($name)');
+
+		if (!AnewtConfig::is_set($name))
+			throw new AnewtException(
+				'No such configuration key: %s', $name);
+
 		global $_anewt_config;
 		return $_anewt_config[$name];
 	}