import {FastifyReply} from "fastify"; import {renderFile} from "pug"; /** Renders the error page into the given reply. */ export function renderError({ baseUrl, code = 500, res, error, context, errorUrl, buttonText, buttonUrl }: { baseUrl: string, code?: number, res: FastifyReply, error: unknown, context: string, errorUrl?: string, buttonText?: string, buttonUrl?: string }): void { res.code(code) res.type("text/html") res.send(renderFile("static/pages/setup/error.pug", { baseUrl, error, context, errorUrl, buttonText: buttonText ?? "Return to Setup", buttonUrl: buttonUrl ?? "setup" })) }