|
10 | 10 | use Magento\Framework\Exception\FileSystemException;
|
11 | 11 | use Magento\Framework\Exception\LocalizedException;
|
12 | 12 | use Magento\Framework\Filesystem;
|
13 |
| -use Magento\Framework\View\Asset\File\NotFoundException; |
14 | 13 | use Magento\Framework\View\Asset\Repository as AssetRepository;
|
15 | 14 | use Magento\Framework\View\Element\Block\ArgumentInterface;
|
16 | 15 | use Magento\Translation\Model\Js\Config as JsConfig;
|
@@ -64,26 +63,20 @@ public function __construct(
|
64 | 63 | * Get translation dictionary file content.
|
65 | 64 | *
|
66 | 65 | * @return string
|
| 66 | + * @throws FileSystemException |
| 67 | + * @throws LocalizedException |
67 | 68 | */
|
68 | 69 | public function getTranslationDictionary(): string
|
69 | 70 | {
|
70 | 71 | if ($this->appState->getMode() === AppState::MODE_PRODUCTION) {
|
71 |
| - try { |
72 |
| - $asset = $this->assetRepo->createAsset(JsConfig::DICTIONARY_FILE_NAME); |
73 |
| - $staticViewFilePath = $this->filesystem->getDirectoryRead( |
74 |
| - DirectoryList::STATIC_VIEW |
75 |
| - )->getAbsolutePath(); |
76 |
| - $content = $this->filesystemDriver->fileGetContents($staticViewFilePath . $asset->getPath()); |
77 |
| - } catch (LocalizedException | FileSystemException $e) { |
78 |
| - $content = ''; |
79 |
| - } |
| 72 | + $asset = $this->assetRepo->createAsset(JsConfig::DICTIONARY_FILE_NAME); |
| 73 | + $staticViewFilePath = $this->filesystem->getDirectoryRead( |
| 74 | + DirectoryList::STATIC_VIEW |
| 75 | + )->getAbsolutePath(); |
| 76 | + $content = $this->filesystemDriver->fileGetContents($staticViewFilePath . $asset->getPath()); |
80 | 77 | } else {
|
81 |
| - try { |
82 |
| - $asset = $this->assetRepo->createAsset(JsConfig::DICTIONARY_FILE_NAME); |
83 |
| - $content = $asset->getContent(); |
84 |
| - } catch (LocalizedException | NotFoundException $e) { |
85 |
| - $content = ''; |
86 |
| - } |
| 78 | + $asset = $this->assetRepo->createAsset(JsConfig::DICTIONARY_FILE_NAME); |
| 79 | + $content = $asset->getContent(); |
87 | 80 | }
|
88 | 81 |
|
89 | 82 | return $content;
|
|
0 commit comments