Register the error and exception handlers.
@return void
182874
public function register()
    {
        $debugLevel = $this->getDebugLevel();

        if ($this->shouldBeDebugging()) {
            ob_start();
            register_shutdown_function(function() {
                if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) {
                    return;
                }

                $error = error_get_last();
                if (!is_array($error)) {
                    return;
                }

                if (!in_array($error['type'], $this->getFatalErrorsTypes(), true)) {
                    return;
                }

                if (!$this->canCatchTheError($error['file'])) {
                    return;
                }

                $this->handleFatalError(
                    $error['type'],
                    $error['message'],
                    $error['file'],
                    $error['line']
                );
            });
            set_error_handler(array($this, 'handleError'), $debugLevel);
            set_exception_handler(array($this, 'wrapAndHandleException'));

            error_reporting($debugLevel);
            ini_set($debugLevel);
        }
    }
302702
public function fatalHandler() : void
    {
        $errors = error_get_last();
        if (is_array($errors)) {
            $this->setError(
               (int) $errors['type'],
                (string) $errors['message'],
                (string) $errors['file'],
                (int) $errors['line'],
                'FatalErrorException'
            );

            View::render('500.php', (object) $this->errors);

            return;
        }
    }
269710
public function register()
    {
        $this->initializeConfigs();

        $this->registerAppVersionManager();

        $this->registerHelpers();

        $this->registerBlade();

        if ($this->app->runningInConsole()) {
            $this->registerArtisanCommands();
        }
    }
1316305
public function register()
    {
        // Handle case-insensitivity of class names.
        $this->newClasses    = $this->arrayKeysToLowercase($this->newClasses);
        $this->newExceptions = $this->arrayKeysToLowercase($this->newExceptions);

        // Add the Exception classes to the Classes list.
        $this->newClasses = array_merge($this->newClasses, $this->newExceptions);

        $targets = array(
            \T_NEW,
            \T_CLASS,
            \T_DOUBLE_COLON,
            \T_FUNCTION,
            \T_CLOSURE,
            \T_CATCH,
        );

        if (\defined('T_ANON_CLASS')) {
            $targets[] = \T_ANON_CLASS;
        }

        if (\defined('T_RETURN_TYPE')) {
            $targets[] = \T_RETURN_TYPE;
        }

        return $targets;
    }
664689
public function register()
    {
        $this->registerFoundation();

        $this->registerMetaContainer();

        $this->registerThrottlesLogins();

        $this->registerFacadesAliases();

        $this->registerCoreContainerAliases();

        $this->registerEventListeners();
    }
908678
def register_errors_handler(self, callback, *custom_filters, exception=None, run_task=None, **kwargs):
        
        filters_set = self.filters_factory.resolve(self.errors_handlers,
                                                   *custom_filters,
                                                   exception=exception,
                                                   **kwargs)
        self.errors_handlers.register(self._wrap_async_task(callback, run_task), filters_set)
1070357
public static function initialiseErrorHandler()
    {
        // Initialise logging
        self::initialiseLog();
        GenericExceptionHandler::initialise(self::Log());
        GenericErrorHandler::initialise(self::Log());
    }
36509
public function register()
    {
        if (!$this->isRegistered) {
            $this->system->setErrorHandler([$this, self::ERROR_HANDLER]);
            $this->system->setExceptionHandler([$this, self::EXCEPTION_HANDLER]);
            $this->system->registerShutdownFunction([$this, self::SHUTDOWN_HANDLER]);

            $this->isRegistered = true;
        }

        return $this;
    }
184072
protected function bootErrorHandling()
    {
        // Register error handler
        $errorHandler = Injector::inst()->get(ErrorHandler::class);
        $errorHandler->start();

        // Register error log file
        $errorLog = Environment::getEnv('SS_ERROR_LOG');
        if ($errorLog) {
            $logger = Injector::inst()->get(LoggerInterface::class);
            if ($logger instanceof Logger) {
                $logger->pushHandler(new StreamHandler($this->basePath . '/' . $errorLog, Logger::WARNING));
            } else {
                user_error("SS_ERROR_LOG setting only works with Monolog, you are using another logger", E_USER_WARNING);
            }
        }
    }
125830
protected function registerWhoops()
	{
		$this->registerWhoopsHandler();

		$this->app['whoops'] = $this->app->share(function($app)
		{
			// We will instruct Whoops to not exit after it displays the exception as it
			// will otherwise run out before we can do anything else. We just want to
			// let the framework go ahead and finish a request on this end instead.
			with($whoops = new Run)->allowQuit(false);

			$whoops->writeToOutput(false);

			return $whoops->pushHandler($app['whoops.handler']);
		});
	}
469800
public function register()
    {
        $this->bindContracts();
        $this->bindConfig();
        $this->bindSender();
        $this->bindResolver();
        $this->bindNotifynder();

        $this->registerSenders();
    }
1310309
protected function register(): void
	{
		// Allows us to handle "fatal" errors

		register_shutdown_function(function(): void
		{
			$e = error_get_last();

			if($e !== null && (error_reporting() & $e['type']) !== 0 && !$this->disableShutdownHandler)
			{
				$this->handler(new ErrorException($e['message'], $e['type'], 0, $e['file'], $e['line']));

				exit(1);
			}
		});

		// Set the exception handler

		set_exception_handler([$this, 'handler']);
	}
1126739
public function register()
    {
        $errorLevel = $this->config('errorLevel');
        set_error_handler([$this, 'handleError'], $errorLevel);
        set_exception_handler([$this, 'handle']);
        register_shutdown_function(function () {
            if (PHP_SAPI === 'cli') {
                return;
            }
            $error = error_get_last();
            if (!is_array($error)) {
                return;
            }
            $fatals = [
                E_USER_ERROR,
                E_ERROR,
                E_PARSE,
            ];
            if (!in_array($error['type'], $fatals, true)) {
                return;
            }
            $this->handleFatalError(
                $error['type'],
                $error['message'],
                $error['file'],
                $error['line']
            );
        });
    }
1252237
private function registerExceptionHandler()
    {
        $handler = $this->app[ExceptionHandlerContract::class];

        $this->singleton(ExceptionHandlerContract::class, function ($app) use ($handler) {
            return new Exceptions\Handler($app[Contracts\Tracker::class], $handler);
        });
    }
975539
public static function register()
	{
		$class = new self();
		Events::addListener(array($class, 'screenLogEventListener'), 'screenLogEvent', EventPriority::NORMAL);
		$bar = Debugger::getBar();
		$bar->addPanel($class);
	}
697777
public function register()
    {
        $this->mergeConfig();
        $this->setupCache();
        $this->setupMetaData();
        $this->setupConnection();
        $this->registerManagerRegistry();
        $this->registerEntityManager();
        $this->registerClassMetaDataFactory();
        $this->registerExtensions();
        $this->registerConsoleCommands();
        $this->registerCustomTypes();
        $this->registerEntityFactory();
        $this->registerProxyAutoloader();

        if ($this->shouldRegisterDoctrinePresenceValidator()) {
            $this->registerPresenceVerifierProvider();
        }
    }
1230202
public function register()
    {
        $events = $this->app->config('event');

        foreach($events as $name => $handlers) {
            $this->events[$name] = $handlers;
        }
    }