public static function generate($message = null, \CMain $APPLICATION = null)
    {
        if (null === $APPLICATION) {
            $APPLICATION = $GLOBALS['APPLICATION'];
        }

        if ($ex = $APPLICATION->GetException()) {
            throw new static($message ? $message . ': ' . $ex->GetString() : $ex->GetString());
        } else {
            throw new static($message ? $message : 'Unknown exception');
        }
    }
public static function generate($message = null, \CMain $APPLICATION = null)
    {
        if (null === $APPLICATION) {
            $APPLICATION = $GLOBALS['APPLICATION'];
        }

        if ($ex = $APPLICATION->GetException()) {
            throw new static($message ? $message . ': ' . $ex->GetString() : $ex->GetString());
        } else {
            throw new static($message ? $message : 'Unknown exception');
        }
    }
public static function generate ( $ message = null , \ CMain $ APPLICATION = null ) { if ( null === $ APPLICATION ) { $ APPLICATION = $ GLOBALS [ 'APPLICATION' ] ; } if ( $ ex = $ APPLICATION -> GetException ( ) ) { throw new static ( $ message ? $ message . ': ' . $ ex -> GetString ( ) : $ ex -> GetString ( ) ) ; } else { throw new static ( $ message ? $ message : 'Unknown exception' ) ; } }
Check for legacy bitrix exception, throws new self if any

@param string $message [optional] Additional error message
@param \CMain $APPLICATION [optional] $APPLICATION instance
@throws static
Check for legacy bitrix exception throws new self if any