File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class App extends Router
1919{
2020 /**
2121 * Callable to be invoked on application error
22- * @var Exception\Run| \Leaf\Crash\Handler|null
22+ * @var \Leaf\Crash\Handler|null
2323 */
2424 protected static $ errorHandler = null ;
2525
@@ -97,14 +97,7 @@ protected function setupErrorHandler()
9797 return ;
9898 }
9999
100- if (class_exists (\Leaf \Crash \Handler::class)) {
101- static ::$ errorHandler = new \Leaf \Crash \Handler (crash ());
102- static ::$ errorHandler ->register ();
103-
104- return ;
105- }
106-
107- static ::$ errorHandler = new Exception \Run ();
100+ static ::$ errorHandler = new \Leaf \Crash \Handler (crash ());
108101 static ::$ errorHandler ->register ();
109102 }
110103
@@ -115,25 +108,12 @@ protected function setupErrorHandler()
115108 public function setErrorHandler ($ handler )
116109 {
117110 if (Anchor::toBool (Config::getStatic ('debug ' )) === false ) {
118- if (static ::$ errorHandler instanceof \Leaf \Crash \Handler) {
119- static ::$ errorHandler ->renderWith (function ($ report ) use ($ handler ) {
120- ob_start ();
121- $ handler ($ report );
122-
123- return ob_get_clean ();
124- });
125-
126- return ;
127- }
128-
129- if (static ::$ errorHandler instanceof Exception \Run) {
130- static ::$ errorHandler ->unregister ();
131- }
111+ static ::$ errorHandler ->renderWith (function ($ report ) use ($ handler ) {
112+ ob_start ();
113+ $ handler ($ report );
132114
133- static ::$ errorHandler = new Exception \Run ();
134- static ::$ errorHandler
135- ->pushHandler ($ handler )
136- ->register ();
115+ return ob_get_clean ();
116+ });
137117 }
138118 }
139119
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ public static function set404($handler = null)
136136 static ::$ notFoundHandler = $ handler ;
137137 } else {
138138 static ::$ notFoundHandler = function () {
139- \Leaf \Exception \General ::default404 ();
139+ \Leaf \Crash \Pages ::default404 ();
140140 };
141141 }
142142 }
@@ -998,7 +998,7 @@ public static function run(?callable $callback = null)
998998 if ($ appDown === true || $ appDown === 'true ' ) {
999999 if (!static ::$ downHandler ) {
10001000 static ::$ downHandler = function () {
1001- \Leaf \Exception \General ::defaultDown ();
1001+ \Leaf \Crash \Pages ::defaultDown ();
10021002 };
10031003 }
10041004
@@ -1029,7 +1029,7 @@ public static function run(?callable $callback = null)
10291029 if ($ numHandled === 0 ) {
10301030 if (!static ::$ notFoundHandler ) {
10311031 static ::$ notFoundHandler = function () {
1032- \Leaf \Exception \General ::default404 ();
1032+ \Leaf \Crash \Pages ::default404 ();
10331033 };
10341034 }
10351035
You can’t perform that action at this time.
0 commit comments