diff --git a/library/Icinga/Exception/IcingaException.php b/library/Icinga/Exception/IcingaException.php index ab6591b01..62c7942be 100644 --- a/library/Icinga/Exception/IcingaException.php +++ b/library/Icinga/Exception/IcingaException.php @@ -4,6 +4,7 @@ namespace Icinga\Exception; use Exception; +use ReflectionClass; class IcingaException extends Exception { @@ -25,4 +26,17 @@ class IcingaException extends Exception } parent::__construct(vsprintf($message, $args), 0, $exc); } + + /** + * Create the exception from an array of arguments + * + * @param array $args + * + * @return static + */ + public static function create(array $args) + { + $e = new ReflectionClass(get_called_class()); + return $e->newInstanceArgs($args); + } }