/** * This interrupts requests if all else fails. * @param string[] ...$args * @return void * @throws CustomPageNotFoundException */ public function routeNotFound(...$args) { if (!\is1DArray($args)) { throw new CustomPageNotFoundException(\__('Invalid arguments')); } $dirs = $args; $file = \array_pop($dirs); // First: Do we have a custom page at this endpoint? try { if ($this->serveCustomPage($file, $dirs)) { return; } } catch (CustomPageNotFoundException $ex) { $this->log('Custom page not found', LogLevel::INFO, ['cabin' => $this->cabin, 'dirs' => $dirs, 'exception' => \Airship\throwableToArray($ex), 'file' => $file]); } // Second: Is there a redirect at this endpoint? try { $path = \implode('/', $args); if ($this->pages->serveRedirect($path)) { return; } } catch (RedirectException $ex) { $this->log('Redirect missed', LogLevel::INFO); } \http_response_code(404); // Finally: Return a 4o4 $this->lens('404'); return; }