You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
942 B
25 lines
942 B
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"
|
|
}))
|
|
} |