mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 00:04:04 +02:00
parent
8733238a6e
commit
b55a313146
29
library/Icinga/Exception/IcingaException.php
Normal file
29
library/Icinga/Exception/IcingaException.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Icinga\Exception;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class IcingaException extends Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $message format string for vsprintf()
|
||||||
|
* Any futher args: args for vsprintf()
|
||||||
|
* @see vsprintf
|
||||||
|
*
|
||||||
|
* If there is at least one exception, the last one will be also used for the exception chaining.
|
||||||
|
*/
|
||||||
|
public function __construct($message = '')
|
||||||
|
{
|
||||||
|
$args = array_slice(func_get_args(), 1);
|
||||||
|
$exc = null;
|
||||||
|
foreach ($args as &$arg) {
|
||||||
|
if ($arg instanceof Exception) {
|
||||||
|
$exc = $arg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parent::__construct(vsprintf($message, $args), 0, $exc);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user