LdapTools\Operation\Invoker\LdapOperationInvokerTrait::logExceptionAndThrow PHP Method

logExceptionAndThrow() protected method

Handles exception error message logging if logging is enabled then re-throws the exception.
protected logExceptionAndThrow ( Throwable | Exception $exception, LogOperation $log = null )
$exception Throwable | Exception
$log LdapTools\Log\LogOperation
    protected function logExceptionAndThrow($exception, LogOperation $log = null)
    {
        if ($this->shouldLog($log) && is_null($log->getStartTime())) {
            $this->logStart($log);
        }
        if ($this->shouldLog($log)) {
            $log->setError($exception->getMessage());
        }
        throw $exception;
    }