private function buildErrorRoute(): void
    {
        //check if there is a declared route for errors, if no exit with false
        if (($key = \array_search($this->badRoute, \array_column($this->routes->getArrayCopy(), 'name'), true)) === false) {
            $this->route = new NullRoute();

            return;
        }

        //build and store route for errors
        $this->route = $this->routes[$key];
    }