Render error pages as HTML
This commit is contained in:
@@ -2,6 +2,7 @@ import { Context } from "@oak/oak";
|
||||
import { nip19 } from "@nostr/tools";
|
||||
import { log } from "../log.ts";
|
||||
import { lookupUsernameByPubkey } from "../ldap.ts";
|
||||
import notFoundHandler from "../handlers/not-found.ts";
|
||||
|
||||
const naddrHandler = async function (ctx: Context) {
|
||||
const naddr = ctx.params.path;
|
||||
@@ -13,13 +14,11 @@ const naddrHandler = async function (ctx: Context) {
|
||||
if (username && r.data.identifier) {
|
||||
ctx.response.redirect(`/@${username}/${r.data.identifier}`);
|
||||
} else {
|
||||
ctx.response.status = 404;
|
||||
ctx.response.body = "Not Found";
|
||||
notFoundHandler(ctx);
|
||||
}
|
||||
} catch (e) {
|
||||
log(e, "yellow");
|
||||
ctx.response.status = 404;
|
||||
ctx.response.body = "Not Found";
|
||||
notFoundHandler(ctx);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user