public function register()
    {
        if ($this->registered) {
            return;
        }
        $this->prevDisplayErrors = \ini_set('display_errors', 0);
        $this->prevErrorHandler = \set_error_handler(array($this, 'handleError'));
        $this->prevExceptionHandler = \set_exception_handler(array($this, 'handleException'));
        $this->registered = true;   // used by this->onShutdown()
        return;
    }