Skip to content

Commit 17d7341

Browse files
committed
Более информативные сообщения об ошибках контейнера.
1 parent 3120566 commit 17d7341

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/ServiceProvider.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,14 @@ private function setupEnv() : void
322322
*/
323323
private function boot() : void
324324
{
325-
$result = $this->initContainer($this->filename);
326-
if (!$result) {
327-
$this->errorHandler->die('Container DI inititalization error.');
328-
throw new Exception('Container DI inititalization error.');
325+
try {
326+
$this->initContainer($this->filename);
327+
} catch (Exception $e) {
328+
$this->errorHandler->die(
329+
'Ошибка сервис-контейнера: '.$e->getMessage() . ' in ' . $e->getFile() . ' ' . $e->getLine()
330+
);
331+
332+
return;
329333
}
330334
}
331335

@@ -335,6 +339,7 @@ private function boot() : void
335339
* @param string $fileName Конфиг.
336340
*
337341
* @return mixed
342+
* @throws Exception Ошибки контейнера.
338343
*
339344
* @since 28.09.2020 Доработка.
340345
*/

0 commit comments

Comments
 (0)