1212use Yiisoft \ErrorHandler \CompositeException ;
1313use Yiisoft \ErrorHandler \ErrorData ;
1414use Yiisoft \ErrorHandler \Exception \ErrorException ;
15+ use Yiisoft \ErrorHandler \Solution \SolutionGenerator ;
16+ use Yiisoft \ErrorHandler \Solution \FriendlyExceptionSolution ;
1517use Yiisoft \ErrorHandler \ThrowableRendererInterface ;
1618use Yiisoft \FriendlyException \FriendlyExceptionInterface ;
1719
@@ -104,6 +106,8 @@ final class HtmlRenderer implements ThrowableRendererInterface
104106 */
105107 private ?array $ vendorPaths = null ;
106108
109+ private SolutionGenerator $ solutionGenerator ;
110+
107111 /**
108112 * @param array $settings Settings can have the following keys:
109113 * - template: string, full path of the template file for rendering exceptions without call stack information.
@@ -131,6 +135,7 @@ public function __construct(array $settings = [])
131135 $ this ->maxSourceLines = $ settings ['maxSourceLines ' ] ?? 19 ;
132136 $ this ->maxTraceLines = $ settings ['maxTraceLines ' ] ?? 13 ;
133137 $ this ->traceHeaderLine = $ settings ['traceHeaderLine ' ] ?? null ;
138+ $ this ->solutionGenerator = new SolutionGenerator ([new FriendlyExceptionSolution ()]);
134139 }
135140
136141 public function render (Throwable $ t , ServerRequestInterface $ request = null ): ErrorData
@@ -143,9 +148,12 @@ public function render(Throwable $t, ServerRequestInterface $request = null): Er
143148
144149 public function renderVerbose (Throwable $ t , ServerRequestInterface $ request = null ): ErrorData
145150 {
151+ $ solutions = $ this ->solutionGenerator ->generate ($ t );
152+
146153 return new ErrorData ($ this ->renderTemplate ($ this ->verboseTemplate , [
147154 'request ' => $ request ,
148155 'throwable ' => $ t ,
156+ 'solutions ' => $ solutions ,
149157 ]));
150158 }
151159
0 commit comments