Icinga\Util\File: throw an ErrorException with file and linenumber details

This commit is contained in:
Johannes Meyer 2014-06-27 09:53:50 +02:00
parent a4fc6dedea
commit 9c1ee57628

View File

@ -5,6 +5,7 @@
namespace Icinga\Util; namespace Icinga\Util;
use SplFileObject; use SplFileObject;
use ErrorException;
use RuntimeException; use RuntimeException;
use Icinga\Exception\NotWritableError; use Icinga\Exception\NotWritableError;
@ -128,9 +129,9 @@ class File extends SplFileObject
protected function setupErrorHandler() protected function setupErrorHandler()
{ {
set_error_handler( set_error_handler(
function ($errno, $errstr) { function ($errno, $errstr, $errfile, $errline) {
restore_error_handler(); restore_error_handler();
throw new RuntimeException($errstr); throw new ErrorException($errno, $errstr, $errfile, $errline);
}, },
E_WARNING E_WARNING
); );