Просмотр исходного кода

Added FormattedException to base file

Taddeus Kroes 13 лет назад
Родитель
Сommit
b646dfc0c1
1 измененных файлов с 18 добавлено и 1 удалено
  1. 18 1
      base.php

+ 18 - 1
base.php

@@ -66,12 +66,29 @@ abstract class Base {
 	}
 	}
 }
 }
 
 
+/**
+ * Exception with sprintf()-like constructor for error message formatting.
+ * 
+ * @package WebBasics
+ * @link http://php.net/sprintf
+ */
+class FormattedException extends \Exception {
+	/**
+	 * Constructor, sets a formatted error message.
+     * @link http://php.net/sprintf
+	 */
+	function __construct() {
+		$args = func_get_args();
+		$this->message = call_user_func_array('sprintf', $args);
+	}
+}
+
 /**
 /**
  * Exception, thrown when a required file does not exist.
  * Exception, thrown when a required file does not exist.
  * 
  * 
  * @package WebBasics
  * @package WebBasics
  */
  */
-class FileNotFoundError extends \RuntimeException {
+class FileNotFoundError extends \Exception {
 	/**
 	/**
 	 * Create a new FileNotFoundError instance.
 	 * Create a new FileNotFoundError instance.
 	 * 
 	 *