File tree Expand file tree Collapse file tree 4 files changed +28
-4
lines changed
Expand file tree Collapse file tree 4 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 7373 "source-directory" : " config"
7474 },
7575 "config-plugin" : {
76- "di-web" : " di-web.php"
76+ "di-web" : " di-web.php" ,
77+ "params" : " params.php"
7778 }
7879 },
7980 "config" : {
Original file line number Diff line number Diff line change 1111
1212return [
1313 ThrowableRendererInterface::class => HtmlRenderer::class,
14+ HtmlRenderer::class => [
15+ '__construct() ' => [
16+ 'solutionProviders ' => $ params ['yiisoft/error-handler ' ]['solutionProviders ' ],
17+ ],
18+ ],
1419];
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use Yiisoft \ErrorHandler \Renderer \HtmlRenderer ;
6+ use Yiisoft \ErrorHandler \ThrowableRendererInterface ;
7+
8+ /**
9+ * @var array $params
10+ */
11+
12+ return [
13+ 'yiisoft/error-handler ' => [
14+ 'solutionProviders ' => [
15+ \Yiisoft \Definitions \Reference::to (\Yiisoft \ErrorHandler \Solution \FriendlyExceptionSolution::class),
16+ ]
17+ ]
18+ ];
Original file line number Diff line number Diff line change 1313use Yiisoft \ErrorHandler \ErrorData ;
1414use Yiisoft \ErrorHandler \Exception \ErrorException ;
1515use Yiisoft \ErrorHandler \Solution \SolutionGenerator ;
16- use Yiisoft \ErrorHandler \Solution \FriendlyExceptionSolution ;
1716use Yiisoft \ErrorHandler \ThrowableRendererInterface ;
1817use Yiisoft \FriendlyException \FriendlyExceptionInterface ;
1918
@@ -123,8 +122,9 @@ final class HtmlRenderer implements ThrowableRendererInterface
123122 * maxTraceLines?: int,
124123 * traceHeaderLine?: string,
125124 * } $settings
125+ * @param \Yiisoft\ErrorHandler\Solution\SolutionProviderInterface[] $solutionProviders
126126 */
127- public function __construct (array $ settings = [])
127+ public function __construct (array $ settings = [], array $ solutionProviders = [] )
128128 {
129129 $ this ->markdownParser = new GithubMarkdown ();
130130 $ this ->markdownParser ->html5 = true ;
@@ -135,7 +135,7 @@ public function __construct(array $settings = [])
135135 $ this ->maxSourceLines = $ settings ['maxSourceLines ' ] ?? 19 ;
136136 $ this ->maxTraceLines = $ settings ['maxTraceLines ' ] ?? 13 ;
137137 $ this ->traceHeaderLine = $ settings ['traceHeaderLine ' ] ?? null ;
138- $ this ->solutionGenerator = new SolutionGenerator ([ new FriendlyExceptionSolution ()] );
138+ $ this ->solutionGenerator = new SolutionGenerator ($ solutionProviders );
139139 }
140140
141141 public function render (Throwable $ t , ServerRequestInterface $ request = null ): ErrorData
You can’t perform that action at this time.
0 commit comments