protected function _throwException($exception = null)
    {
        if ($exception !== null) {
            if (!Configure::read('debug') && $exception instanceof SecurityException) {
                $exception->setReason($exception->getMessage());
                $exception->setMessage(self::DEFAULT_EXCEPTION_MESSAGE);
            }
            throw $exception;
        }
        throw new BadRequestException(self::DEFAULT_EXCEPTION_MESSAGE);
    }
protected function _throwException($exception = null)
    {
        if ($exception !== null) {
            if (!Configure::read('debug') && $exception instanceof SecurityException) {
                $exception->setReason($exception->getMessage());
                $exception->setMessage(self::DEFAULT_EXCEPTION_MESSAGE);
            }
            throw $exception;
        }
        throw new BadRequestException(self::DEFAULT_EXCEPTION_MESSAGE);
    }
protected function _throwException ( $ exception = null ) { if ( $ exception !== null ) { if ( ! Configure :: read ( 'debug' ) && $ exception instanceof SecurityException ) { $ exception -> setReason ( $ exception -> getMessage ( ) ) ; $ exception -> setMessage ( self :: DEFAULT_EXCEPTION_MESSAGE ) ; } throw $ exception ; } throw new BadRequestException ( self :: DEFAULT_EXCEPTION_MESSAGE ) ; }
Check debug status and throw an Exception based on the existing one

@param \Cake\Controller\Exception\SecurityException|null $exception Additional debug info describing the cause
@throws \Cake\Http\Exception\BadRequestException
@return void
Check debug status and throw an Exception based on the existing one