Rocky_Mountain_Vending/.pnpm-store/v10/files/81/b5bea6083413400aee4d560a560d71d3c041682dc7f2d06466d5eb79102170d96c60764c0db6ba08dac7fcd4a061154c4ff84964bf371cbe7d0ec6c10ed57f
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

40 lines
1,011 B
Text

import type { Middleware } from "./common";
// A middleware has to be a function of type Middleware
const prettyError: Middleware = async (request, env, _ctx, middlewareCtx) => {
try {
const response = await middlewareCtx.next(request, env);
return response;
} catch (e: any) {
const html = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Error 🚨</title>
<style>
pre {
margin: 16px auto;
max-width: 600px;
background-color: #eeeeee;
border-radius: 4px;
padding: 16px;
}
</style>
</head>
<body>
<pre>${e.stack}</pre>
</body>
</html>
`;
return new Response(html, {
status: 500,
headers: { "Content-Type": "text/html;charset=utf-8" },
});
}
};
export default prettyError;