Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core/router.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EVENT_BUS } from "./";
import {buildErrorPage} from "../views/error404.ts";

type RouteHandler = (params?: Record<string, string>) => void;

Expand Down Expand Up @@ -27,6 +28,7 @@ class Router {
return;
}
}
buildErrorPage();
console.error(`No handler found for path: ${path}`);
}

Expand Down
17 changes: 15 additions & 2 deletions src/views/error404.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@

export function buildErrorPage() {
import {writeTitle} from "./utils";
import {renderView} from "./index.ts";


function errorView() {
const article = document.createElement('article');
const viewTitle = writeTitle("h1", "Page not found 404");

article.appendChild(viewTitle);
return article;
}

//-----------------------------------------------------------------------

export function buildErrorPage() {
renderView(errorView());
}