示例#1
0
 /**
  * @covers ::toString
  * @dataProvider providerToString
  * @expectedException Headzoo\Core\Exceptions\InvalidArgumentException
  */
 public function testToString_Invalid($value)
 {
     Errors::toString($value);
 }
示例#2
0
 /**
  * Calls the error callback
  * 
  * Called by ::handleCoreError() and ::handleUncaughtException() when the type of error
  * captured matches an error being handled. This method calls the error callback, and
  * effectively shuts down the handler.
  * 
  * @param Exception $exception  The error
  * @param string    $label      Label for the reason the error is being triggered
  *
  * @return bool
  */
 protected function triggerError(Exception $exception, $label)
 {
     $this->unhandle();
     $this->last_error = $exception;
     if ($exception instanceof Exceptions\PHPErrorException) {
         $type = Errors::toString($exception->getCode());
     } else {
         $code = $exception->getCode();
         $type = get_class($exception);
         $type = "{$type}[{$code}]";
     }
     $this->logger->error('{label} {type}: "{message}" in file {file}[{line}].', ["label" => $label, "type" => $type, "message" => $exception->getMessage(), "file" => $exception->getFile(), "line" => $exception->getLine()]);
     try {
         call_user_func($this->getCallback(), $this);
     } catch (Exception $e) {
     }
     return true;
 }