mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
feat: migrate to Nuxt 4 (Nitro) and Tailwind CSS v3
This commit is contained in:
166 files changed
+19790
-5539
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import defaultNitroErrorHandler, {
|
||||
defineNitroErrorHandler,
|
||||
} from "nitropack/runtime/error";
|
||||
import { setResponseStatus } from "h3";
|
||||
|
||||
/**
|
||||
* Keep the legacy API error contract (`{ error: string }` JSON) for the
|
||||
* machine-facing endpoints; everything else (pages) uses the default handler.
|
||||
*/
|
||||
export default defineNitroErrorHandler((error, event) => {
|
||||
const path = event.path ?? "";
|
||||
if (
|
||||
path.startsWith("/admin/api/") ||
|
||||
path.startsWith("/api/") ||
|
||||
path.startsWith("/auth/") ||
|
||||
path.startsWith("/webhook")
|
||||
) {
|
||||
setResponseStatus(event, error.statusCode || 500);
|
||||
return { error: error.statusMessage || error.message || "Internal Server Error" };
|
||||
}
|
||||
return defaultNitroErrorHandler(error, event);
|
||||
});
|
||||
Reference in new issue
Block a user