@@ -174,7 +174,11 @@ public function clearHandlers()
174174 public function register ()
175175 {
176176 if (empty ($ this ->getHandlers ())) {
177- $ this ->pushHandler (new \Leaf \Exception \Handler \PrettyPageHandler );
177+ if ((bool ) \Leaf \Config::get ("debug " )) {
178+ $ this ->pushHandler (new \Leaf \Exception \Handler \PrettyPageHandler );
179+ } else {
180+ $ this ->pushHandler (new \Leaf \Exception \Handler \CustomHandler );
181+ }
178182 }
179183
180184 if (!$ this ->isRegistered ) {
@@ -439,10 +443,10 @@ public function handleException($exception)
439443 */
440444 public function handleError ($ level , $ message , $ file = null , $ line = null )
441445 {
442- if ($ level& $ this ->system ->getErrorReportingLevel ()) {
446+ if ($ level & $ this ->system ->getErrorReportingLevel ()) {
443447 foreach ($ this ->silencedPatterns as $ entry ) {
444448 $ pathMatches = (bool ) preg_match ($ entry ["pattern " ], $ file );
445- $ levelMatches = $ level& $ entry ["levels " ];
449+ $ levelMatches = $ level & $ entry ["levels " ];
446450 if ($ pathMatches && $ levelMatches ) {
447451 // Ignore the error, abort handling
448452 // See https://github.com/filp/whoops/issues/418
@@ -527,7 +531,7 @@ private function resolveHandler($handler)
527531 if (!$ handler instanceof HandlerInterface) {
528532 throw new InvalidArgumentException (
529533 "Handler must be a callable, or instance of "
530- . "Leaf \\Exception \\Handler \\HandlerInterface "
534+ . "Leaf \\Exception \\Handler \\HandlerInterface "
531535 );
532536 }
533537
0 commit comments