fix: throw error if fetch called before build

added a check in the fetch getter to prevent its usage before the application is built, ensuring proper usage and avoiding runtime issues.
This commit is contained in:
dswbx
2025-09-24 09:53:28 +02:00
parent 83c1c86eff
commit aa8bf156b0

View File

@@ -244,6 +244,10 @@ export class App<
}
get fetch(): Hono["fetch"] {
if (!this.isBuilt()) {
throw new Error("App is not built yet, run build() first");
}
return this.server.fetch as any;
}