File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,12 @@ public function logout()
6969
7070 public function run ()
7171 {
72- echo $ this ->router ->resolve ();
72+ try {
73+ echo $ this ->router ->resolve ();
74+ } catch (\Exception $ e ) {
75+ echo $ this ->router ->renderView ('_error ' , [
76+ 'exception ' => $ e ,
77+ ]);
78+ }
7379 }
7480}
Original file line number Diff line number Diff line change @@ -49,8 +49,15 @@ public function resolve()
4949 return $ this ->renderView ($ callback );
5050 }
5151 if (is_array ($ callback )) {
52+ /**
53+ * @var $controller \app\core\Controller
54+ */
5255 $ controller = new $ callback [0 ];
5356 Application::$ app ->controller = $ controller ;
57+ $ middlewares = $ controller ->getMiddlewares ();
58+ foreach ($ middlewares as $ middleware ) {
59+ $ middleware ->execute ();
60+ }
5461 $ callback [0 ] = $ controller ;
5562 }
5663 return call_user_func ($ callback , $ this ->request , $ this ->response );
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * User: TheCodeholic
4+ * Date: 7/11/2020
5+ * Time: 10:12 AM
6+ */
7+ /** @var $exception \Exception */
8+ ?>
9+
10+ <h3><?php echo $ exception ->getCode () ?> - <?php echo $ exception ->getMessage () ?> </h3>
You can’t perform that action at this time.
0 commit comments