_validateRequestPath($requestPath); } catch (\Exception $e) { throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage())); } return true; } /** * Validates suffix for url rewrites to inform user about errors in it * Either returns TRUE (success) or throws error (validation failed) * * @param string $suffix * @throws \Magento\Framework\Exception\LocalizedException * @return bool */ public function validateSuffix($suffix) { try { // Suffix itself must be a valid request path $this->_validateRequestPath($suffix); } catch (\Exception $e) { // Make message saying about suffix, not request path switch ($e->getCode()) { case self::VERR_MANYSLASHES: throw new \Magento\Framework\Exception\LocalizedException( __('Do not use two or more consecutive slashes in the url rewrite suffix.') ); case self::VERR_ANCHOR: throw new \Magento\Framework\Exception\LocalizedException( __('Anchor symbol (#) is not supported in url rewrite suffix.') ); } } return true; } }