6
6
7
7
namespace Magento \Framework \Mview \View ;
8
8
9
+ use Magento \Framework \Exception \LocalizedException ;
10
+ use Magento \Framework \Exception \SessionException ;
9
11
use Magento \Framework \Phrase ;
10
12
11
13
/**
@@ -58,12 +60,14 @@ public function __construct(\Magento\Framework\App\ResourceConnection $resource)
58
60
* Check DB connection
59
61
*
60
62
* @return void
61
- * @throws \Exception
63
+ * @throws \Magento\Framework\ Exception\SessionException
62
64
*/
63
65
protected function checkConnection ()
64
66
{
65
67
if (!$ this ->connection ) {
66
- throw new \Exception ("The write connection to the database isn't available. Please try again later. " );
68
+ throw new SessionException (
69
+ new Phrase ("The write connection to the database isn't available. Please try again later. " )
70
+ );
67
71
}
68
72
}
69
73
@@ -167,7 +171,7 @@ public function getList($fromVersionId, $toVersionId)
167
171
*
168
172
* @return int
169
173
* @throws ChangelogTableNotExistsException
170
- * @throws \Exception
174
+ * @throws LocalizedException
171
175
*/
172
176
public function getVersion ()
173
177
{
@@ -179,7 +183,9 @@ public function getVersion()
179
183
if (isset ($ row ['Auto_increment ' ])) {
180
184
return (int )$ row ['Auto_increment ' ] - 1 ;
181
185
} else {
182
- throw new \Exception ("Table status for ` {$ changelogTableName }` is incorrect. Can`t fetch version id. " );
186
+ throw new LocalizedException (
187
+ new Phrase ("Table status for ` {$ changelogTableName }` is incorrect. Can`t fetch version id. " )
188
+ );
183
189
}
184
190
}
185
191
@@ -188,13 +194,15 @@ public function getVersion()
188
194
*
189
195
* Build a changelog name by concatenating view identifier and changelog name suffix.
190
196
*
191
- * @throws \Exception
197
+ * @throws \Magento\Framework\ Exception\LocalizedException
192
198
* @return string
193
199
*/
194
200
public function getName ()
195
201
{
196
202
if (strlen ($ this ->viewId ) == 0 ) {
197
- throw new \Exception ("View's identifier is not set " );
203
+ throw new LocalizedException (
204
+ new Phrase ("View's identifier is not set " )
205
+ );
198
206
}
199
207
return $ this ->viewId . '_ ' . self ::NAME_SUFFIX ;
200
208
}
0 commit comments