Skip to content

Commit 92b81bf

Browse files
authored
ENGCOM-3671: Add useful debug info for which website has not been found #19709
2 parents 2755c67 + 88dd1c8 commit 92b81bf

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

app/code/Magento/Store/Model/WebsiteRepository.php

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
namespace Magento\Store\Model;
88

9+
use Magento\Framework\App\Config;
910
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\Exception\NoSuchEntityException;
1112
use Magento\Store\Model\ResourceModel\Website\CollectionFactory;
12-
use Magento\Framework\App\Config;
1313

1414
/**
1515
* Information Expert in store websites handling
@@ -64,7 +64,7 @@ public function __construct(
6464
}
6565

6666
/**
67-
* {@inheritdoc}
67+
* @inheritdoc
6868
*/
6969
public function get($code)
7070
{
@@ -78,15 +78,22 @@ public function get($code)
7878
]);
7979

8080
if ($website->getId() === null) {
81-
throw new NoSuchEntityException();
81+
throw new NoSuchEntityException(
82+
__(
83+
sprintf(
84+
"The website with code %s that was requested wasn't found. Verify the website and try again.",
85+
$code
86+
)
87+
)
88+
);
8289
}
8390
$this->entities[$code] = $website;
8491
$this->entitiesById[$website->getId()] = $website;
8592
return $website;
8693
}
8794

8895
/**
89-
* {@inheritdoc}
96+
* @inheritdoc
9097
*/
9198
public function getById($id)
9299
{
@@ -100,15 +107,22 @@ public function getById($id)
100107
]);
101108

102109
if ($website->getId() === null) {
103-
throw new NoSuchEntityException();
110+
throw new NoSuchEntityException(
111+
__(
112+
sprintf(
113+
"The website with id %s that was requested wasn't found. Verify the website and try again.",
114+
$id
115+
)
116+
)
117+
);
104118
}
105119
$this->entities[$website->getCode()] = $website;
106120
$this->entitiesById[$id] = $website;
107121
return $website;
108122
}
109123

110124
/**
111-
* {@inheritdoc}
125+
* @inheritdoc
112126
*/
113127
public function getList()
114128
{
@@ -127,7 +141,7 @@ public function getList()
127141
}
128142

129143
/**
130-
* {@inheritdoc}
144+
* @inheritdoc
131145
*/
132146
public function getDefault()
133147
{
@@ -150,7 +164,7 @@ public function getDefault()
150164
}
151165

152166
/**
153-
* {@inheritdoc}
167+
* @inheritdoc
154168
*/
155169
public function clean()
156170
{
@@ -176,6 +190,7 @@ private function getAppConfig()
176190

177191
/**
178192
* Initialize default website.
193+
*
179194
* @return void
180195
*/
181196
private function initDefaultWebsite()

0 commit comments

Comments
 (0)