[{"data":1,"prerenderedAt":1147},["ShallowReactive",2],{"navigation":3,"examples-nav":389,"-examples-custom-error-handler":490,"-examples-custom-error-handler-surround":1144},[4,83,212,218,374,386],{"title":5,"path":6,"stem":7,"children":8,"icon":82},"","/docs","1.docs/1.index",[9,12,17,22,27,32,37,42,47,52,57,62,67,72,77],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-compass",{"title":13,"path":14,"stem":15,"icon":16},"Quick Start","/docs/quick-start","1.docs/2.quick-start","i-lucide-zap",{"title":18,"path":19,"stem":20,"icon":21},"Renderer","/docs/renderer","1.docs/4.renderer","ri:layout-masonry-line",{"title":23,"path":24,"stem":25,"icon":26},"Routing","/docs/routing","1.docs/5.routing","ri:direction-line",{"title":28,"path":29,"stem":30,"icon":31},"Assets","/docs/assets","1.docs/50.assets","ri:image-2-line",{"title":33,"path":34,"stem":35,"icon":36},"Configuration","/docs/configuration","1.docs/50.configuration","ri:settings-3-line",{"title":38,"path":39,"stem":40,"icon":41},"Database","/docs/database","1.docs/50.database","ri:database-2-line",{"title":43,"path":44,"stem":45,"icon":46},"Lifecycle","/docs/lifecycle","1.docs/50.lifecycle","i-lucide-layers",{"title":48,"path":49,"stem":50,"icon":51},"Plugins","/docs/plugins","1.docs/50.plugins","ri:plug-line",{"title":53,"path":54,"stem":55,"icon":56},"Tasks","/docs/tasks","1.docs/50.tasks","codicon:run-all",{"title":58,"path":59,"stem":60,"icon":61},"Server Entry","/docs/server-entry","1.docs/6.server-entry","ri:server-line",{"title":63,"path":64,"stem":65,"icon":66},"Cache","/docs/cache","1.docs/7.cache","ri:speed-line",{"title":68,"path":69,"stem":70,"icon":71},"KV Storage","/docs/storage","1.docs/8.storage","carbon:datastore",{"title":73,"path":74,"stem":75,"icon":76},"Migration Guide","/docs/migration","1.docs/99.migration","ri:arrow-right-up-line",{"title":78,"path":79,"stem":80,"icon":81},"Nightly Channel","/docs/nightly","1.docs/99.nightly","ri:moon-fill","i-lucide-book-open",{"title":84,"path":85,"stem":86,"children":87,"icon":89},"Deploy","/deploy","2.deploy/0.index",[88,90,111],{"title":84,"path":85,"stem":86,"icon":89},"ri:upload-cloud-2-line",{"title":91,"path":92,"stem":93,"children":94,"page":110},"Runtimes","/deploy/runtimes","2.deploy/10.runtimes",[95,100,105],{"title":96,"path":97,"stem":98,"icon":99},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":101,"path":102,"stem":103,"icon":104},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":106,"path":107,"stem":108,"icon":109},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":112,"path":113,"stem":114,"children":115,"page":110},"Providers","/deploy/providers","2.deploy/20.providers",[116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208],{"title":117,"path":118,"stem":119},"Alwaysdata","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":121,"path":122,"stem":123},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":125,"path":126,"stem":127},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":129,"path":130,"stem":131},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":133,"path":134,"stem":135},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":137,"path":138,"stem":139},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":141,"path":142,"stem":143},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":145,"path":146,"stem":147},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":149,"path":150,"stem":151},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":153,"path":154,"stem":155},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":157,"path":158,"stem":159},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":161,"path":162,"stem":163},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":165,"path":166,"stem":167},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":169,"path":170,"stem":171},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":173,"path":174,"stem":175},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":177,"path":178,"stem":179},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":181,"path":182,"stem":183},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":185,"path":186,"stem":187},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":189,"path":190,"stem":191},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":193,"path":194,"stem":195},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":197,"path":198,"stem":199},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":201,"path":202,"stem":203},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":205,"path":206,"stem":207},"Zephyr Cloud","/deploy/providers/zephyr","2.deploy/20.providers/zephyr",{"title":209,"path":210,"stem":211},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":213,"path":214,"stem":215,"children":216,"icon":36},"Config","/config","3.config/0.index",[217],{"title":213,"path":214,"stem":215,"icon":36},{"title":219,"path":220,"stem":221,"children":222,"icon":224},"Examples","/examples","4.examples/0.index",[223,225,230,235,240,245,249,254,259,264,269,274,279,283,288,292,296,301,306,311,316,321,326,331,336,341,345,350,355,359,364,369],{"title":219,"path":220,"stem":221,"icon":224},"i-lucide-folder-code",{"title":226,"path":227,"stem":228,"icon":229},"API Routes","/examples/api-routes","4.examples/api-routes","i-lucide-route",{"title":231,"path":232,"stem":233,"icon":234},"Auto Imports","/examples/auto-imports","4.examples/auto-imports","i-lucide-import",{"title":236,"path":237,"stem":238,"icon":239},"Cached Handler","/examples/cached-handler","4.examples/cached-handler","i-lucide-clock",{"title":241,"path":242,"stem":243,"icon":244},"Custom Error Handler","/examples/custom-error-handler","4.examples/custom-error-handler","i-lucide-alert-circle",{"title":38,"path":246,"stem":247,"icon":248},"/examples/database","4.examples/database","i-lucide-database",{"title":250,"path":251,"stem":252,"icon":253},"Elysia","/examples/elysia","4.examples/elysia","i-skill-icons-elysia-dark",{"title":255,"path":256,"stem":257,"icon":258},"Express","/examples/express","4.examples/express","i-simple-icons-express",{"title":260,"path":261,"stem":262,"icon":263},"Fastify","/examples/fastify","4.examples/fastify","i-simple-icons-fastify",{"title":265,"path":266,"stem":267,"icon":268},"Hello World","/examples/hello-world","4.examples/hello-world","i-lucide-sparkles",{"title":270,"path":271,"stem":272,"icon":273},"Hono","/examples/hono","4.examples/hono","i-logos-hono",{"title":275,"path":276,"stem":277,"icon":278},"Import Alias","/examples/import-alias","4.examples/import-alias","i-lucide-at-sign",{"title":280,"path":281,"stem":282,"icon":46},"Middleware","/examples/middleware","4.examples/middleware",{"title":284,"path":285,"stem":286,"icon":287},"Mono JSX","/examples/mono-jsx","4.examples/mono-jsx","i-lucide-brackets",{"title":289,"path":290,"stem":291,"icon":287},"Nano JSX","/examples/nano-jsx","4.examples/nano-jsx",{"title":48,"path":293,"stem":294,"icon":295},"/examples/plugins","4.examples/plugins","i-lucide-plug",{"title":297,"path":298,"stem":299,"icon":300},"Custom Renderer","/examples/renderer","4.examples/renderer","i-lucide-code",{"title":302,"path":303,"stem":304,"icon":305},"Runtime Config","/examples/runtime-config","4.examples/runtime-config","i-lucide-settings",{"title":307,"path":308,"stem":309,"icon":310},"Server Fetch","/examples/server-fetch","4.examples/server-fetch","i-lucide-arrow-right-left",{"title":312,"path":313,"stem":314,"icon":315},"Shiki","/examples/shiki","4.examples/shiki","i-lucide-highlighter",{"title":317,"path":318,"stem":319,"icon":320},"Virtual Routes","/examples/virtual-routes","4.examples/virtual-routes","i-lucide-box",{"title":322,"path":323,"stem":324,"icon":325},"Vite Nitro Plugin","/examples/vite-nitro-plugin","4.examples/vite-nitro-plugin","i-logos-vitejs",{"title":327,"path":328,"stem":329,"icon":330},"Vite RSC","/examples/vite-rsc","4.examples/vite-rsc","i-logos-react",{"title":332,"path":333,"stem":334,"icon":335},"Vite SSR HTML","/examples/vite-ssr-html","4.examples/vite-ssr-html","i-logos-html-5",{"title":337,"path":338,"stem":339,"icon":340},"SSR with Preact","/examples/vite-ssr-preact","4.examples/vite-ssr-preact","i-logos-preact",{"title":342,"path":343,"stem":344,"icon":330},"SSR with React","/examples/vite-ssr-react","4.examples/vite-ssr-react",{"title":346,"path":347,"stem":348,"icon":349},"SSR with SolidJS","/examples/vite-ssr-solid","4.examples/vite-ssr-solid","i-logos-solidjs-icon",{"title":351,"path":352,"stem":353,"icon":354},"SSR with TanStack Router","/examples/vite-ssr-tsr-react","4.examples/vite-ssr-tsr-react","i-simple-icons-tanstack",{"title":356,"path":357,"stem":358,"icon":354},"SSR with TanStack Start","/examples/vite-ssr-tss-react","4.examples/vite-ssr-tss-react",{"title":360,"path":361,"stem":362,"icon":363},"SSR with Vue Router","/examples/vite-ssr-vue-router","4.examples/vite-ssr-vue-router","i-logos-vue",{"title":365,"path":366,"stem":367,"icon":368},"Vite + tRPC","/examples/vite-trpc","4.examples/vite-trpc","i-simple-icons-trpc",{"title":370,"path":371,"stem":372,"icon":373},"WebSocket","/examples/websocket","4.examples/websocket","i-lucide-radio",{"title":375,"path":376,"stem":377,"children":378},"Blog","/blog","9.blog",[379,382],{"title":375,"path":376,"stem":380,"icon":381},"9.blog/index","i-lucide-file-text",{"title":383,"path":384,"stem":385,"icon":381},"Nitro v3 Beta is here!","/blog/v3-beta","9.blog/1.v3-beta",{"title":5,"path":387,"stem":388},"/","index",[390,395,399,402,405,408,412,415,418,421,424,427,430,434,437,440,443,446,449,453,456,460,463,466,469,472,475,478,481,484,487],{"title":226,"description":391,"meta":392,"path":227},"File-based API routing with HTTP method support and dynamic parameters.",{"automd":393,"category":394,"icon":229},true,"features",{"title":231,"description":396,"meta":397,"path":232},"Automatic imports for utilities and composables.",{"automd":393,"category":398,"icon":234},"config",{"title":236,"description":400,"meta":401,"path":237},"Cache route responses with configurable bypass logic.",{"automd":393,"category":394,"icon":239},{"title":241,"description":403,"meta":404,"path":242},"Customize error responses with a global error handler.",{"automd":393,"category":394,"icon":244},{"title":38,"description":406,"meta":407,"path":246},"Built-in database support with SQL template literals.",{"automd":393,"category":394,"icon":248},{"title":250,"description":409,"meta":410,"path":251},"Integrate Elysia with Nitro using the server entry.",{"automd":393,"category":411,"icon":253},"backend frameworks",{"title":255,"description":413,"meta":414,"path":256},"Integrate Express with Nitro using the server entry.",{"automd":393,"category":411,"icon":258},{"title":260,"description":416,"meta":417,"path":261},"Integrate Fastify with Nitro using the server entry.",{"automd":393,"category":411,"icon":263},{"title":265,"description":419,"meta":420,"path":266},"Minimal Nitro server using the web standard fetch handler.",{"automd":393,"category":394,"icon":268},{"title":270,"description":422,"meta":423,"path":271},"Integrate Hono with Nitro using the server entry.",{"automd":393,"category":411,"icon":273},{"title":275,"description":425,"meta":426,"path":276},"Custom import aliases for cleaner module paths.",{"automd":393,"category":398,"icon":278},{"title":280,"description":428,"meta":429,"path":281},"Request middleware for authentication, logging, and request modification.",{"automd":393,"category":394,"icon":46},{"title":284,"description":431,"meta":432,"path":285},"Server-side JSX rendering in Nitro with mono-jsx.",{"automd":393,"category":433,"icon":287},"server side rendering",{"title":289,"description":435,"meta":436,"path":290},"Server-side JSX rendering in Nitro with nano-jsx.",{"automd":393,"category":433,"icon":287},{"title":48,"description":438,"meta":439,"path":293},"Extend Nitro with custom plugins for hooks and lifecycle events.",{"automd":393,"category":394,"icon":295},{"title":297,"description":441,"meta":442,"path":298},"Build a custom HTML renderer in Nitro with server-side data fetching.",{"automd":393,"category":433,"icon":300},{"title":302,"description":444,"meta":445,"path":303},"Environment-aware configuration with runtime access.",{"automd":393,"category":398,"icon":305},{"title":307,"description":447,"meta":448,"path":308},"Internal server-to-server requests without network overhead.",{"automd":393,"category":394,"icon":310},{"title":312,"description":450,"meta":451,"path":313},"Server-side syntax highlighting in Nitro with Shiki.",{"automd":393,"category":452,"icon":315},"integrations",{"title":317,"description":454,"meta":455,"path":318},"Define routes programmatically using Nitro's virtual module system.",{"automd":393,"category":394,"icon":320},{"title":322,"description":457,"meta":458,"path":323},"Use Nitro as a Vite plugin for programmatic configuration.",{"automd":393,"category":459,"icon":325},"vite",{"title":327,"description":461,"meta":462,"path":328},"React Server Components with Vite and Nitro.",{"automd":393,"category":459,"icon":330},{"title":332,"description":464,"meta":465,"path":333},"Server-side rendering with vanilla HTML, Vite, and Nitro.",{"automd":393,"category":433,"icon":335},{"title":337,"description":467,"meta":468,"path":338},"Server-side rendering with Preact in Nitro using Vite.",{"automd":393,"category":433,"icon":340},{"title":342,"description":470,"meta":471,"path":343},"Server-side rendering with React in Nitro using Vite.",{"automd":393,"category":433,"icon":330},{"title":346,"description":473,"meta":474,"path":347},"Server-side rendering with SolidJS in Nitro using Vite.",{"automd":393,"category":433,"icon":349},{"title":351,"description":476,"meta":477,"path":352},"Client-side routing with TanStack Router in Nitro using Vite.",{"automd":393,"category":433,"icon":354},{"title":356,"description":479,"meta":480,"path":357},"Full-stack React with TanStack Start in Nitro using Vite.",{"automd":393,"category":433,"icon":354},{"title":360,"description":482,"meta":483,"path":361},"Server-side rendering with Vue Router in Nitro using Vite.",{"automd":393,"category":433,"icon":363},{"title":365,"description":485,"meta":486,"path":366},"End-to-end typesafe APIs with tRPC in Nitro using Vite.",{"automd":393,"category":459,"icon":368},{"title":370,"description":488,"meta":489,"path":371},"Real-time bidirectional communication with WebSocket support.",{"automd":393,"category":394,"icon":373},{"id":491,"title":241,"body":492,"description":403,"extension":1139,"meta":1140,"navigation":1141,"path":242,"seo":1142,"stem":243,"__hash__":1143},"content/4.examples/custom-error-handler.md",{"type":493,"value":494,"toc":1134,"icon":244},"minimark",[495,941,945,950,956,1048,1051,1055,1058,1114,1117,1121,1130],[496,497,500,648,708,797,863,887],"code-tree",{":expand-all":498,"default-value":499},"true","error.ts",[501,502,506],"pre",{"className":503,"code":504,"filename":499,"language":505,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { defineErrorHandler } from \"nitro\";\n\nexport default defineErrorHandler((error, _event) => {\n  return new Response(`Custom Error Handler: ${error.message}`, {\n    status: 500,\n    headers: { \"Content-Type\": \"text/plain\" },\n  });\n});\n","ts",[507,508,509,532,538,573,605,618,636,642],"code",{"__ignoreMap":5},[510,511,514,518,522,525,529],"span",{"class":512,"line":513},"line",1,[510,515,517],{"class":516},"so5gQ","import",[510,519,521],{"class":520},"slsVL"," { defineErrorHandler } ",[510,523,524],{"class":516},"from",[510,526,528],{"class":527},"sfrk1"," \"nitro\"",[510,530,531],{"class":520},";\n",[510,533,535],{"class":512,"line":534},2,[510,536,537],{"emptyLinePlaceholder":393},"\n",[510,539,541,544,547,551,554,558,561,564,567,570],{"class":512,"line":540},3,[510,542,543],{"class":516},"export",[510,545,546],{"class":516}," default",[510,548,550],{"class":549},"shcOC"," defineErrorHandler",[510,552,553],{"class":520},"((",[510,555,557],{"class":556},"sQHwn","error",[510,559,560],{"class":520},", ",[510,562,563],{"class":556},"_event",[510,565,566],{"class":520},") ",[510,568,569],{"class":516},"=>",[510,571,572],{"class":520}," {\n",[510,574,576,579,582,585,588,591,593,596,599,602],{"class":512,"line":575},4,[510,577,578],{"class":516},"  return",[510,580,581],{"class":516}," new",[510,583,584],{"class":549}," Response",[510,586,587],{"class":520},"(",[510,589,590],{"class":527},"`Custom Error Handler: ${",[510,592,557],{"class":520},[510,594,595],{"class":527},".",[510,597,598],{"class":520},"message",[510,600,601],{"class":527},"}`",[510,603,604],{"class":520},", {\n",[510,606,608,611,615],{"class":512,"line":607},5,[510,609,610],{"class":520},"    status: ",[510,612,614],{"class":613},"suiK_","500",[510,616,617],{"class":520},",\n",[510,619,621,624,627,630,633],{"class":512,"line":620},6,[510,622,623],{"class":520},"    headers: { ",[510,625,626],{"class":527},"\"Content-Type\"",[510,628,629],{"class":520},": ",[510,631,632],{"class":527},"\"text/plain\"",[510,634,635],{"class":520}," },\n",[510,637,639],{"class":512,"line":638},7,[510,640,641],{"class":520},"  });\n",[510,643,645],{"class":512,"line":644},8,[510,646,647],{"class":520},"});\n",[501,649,652],{"className":503,"code":650,"filename":651,"language":505,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n// import errorHandler from \"./error\";\n\nexport default defineConfig({\n  errorHandler: \"./error.ts\",\n  // devErrorHandler: errorHandler,\n});\n","nitro.config.ts",[507,653,654,667,673,677,689,699,704],{"__ignoreMap":5},[510,655,656,658,661,663,665],{"class":512,"line":513},[510,657,517],{"class":516},[510,659,660],{"class":520}," { defineConfig } ",[510,662,524],{"class":516},[510,664,528],{"class":527},[510,666,531],{"class":520},[510,668,669],{"class":512,"line":534},[510,670,672],{"class":671},"sCsY4","// import errorHandler from \"./error\";\n",[510,674,675],{"class":512,"line":540},[510,676,537],{"emptyLinePlaceholder":393},[510,678,679,681,683,686],{"class":512,"line":575},[510,680,543],{"class":516},[510,682,546],{"class":516},[510,684,685],{"class":549}," defineConfig",[510,687,688],{"class":520},"({\n",[510,690,691,694,697],{"class":512,"line":607},[510,692,693],{"class":520},"  errorHandler: ",[510,695,696],{"class":527},"\"./error.ts\"",[510,698,617],{"class":520},[510,700,701],{"class":512,"line":620},[510,702,703],{"class":671},"  // devErrorHandler: errorHandler,\n",[510,705,706],{"class":512,"line":638},[510,707,647],{"class":520},[501,709,714],{"className":710,"code":711,"filename":712,"language":713,"meta":5,"style":5},"language-json shiki shiki-themes github-light github-dark github-dark","{\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"nitro dev\",\n    \"build\": \"nitro build\"\n  },\n  \"devDependencies\": {\n    \"nitro\": \"latest\"\n  }\n}\n","package.json","json",[507,715,716,721,733,741,753,763,768,775,785,791],{"__ignoreMap":5},[510,717,718],{"class":512,"line":513},[510,719,720],{"class":520},"{\n",[510,722,723,726,728,731],{"class":512,"line":534},[510,724,725],{"class":613},"  \"type\"",[510,727,629],{"class":520},[510,729,730],{"class":527},"\"module\"",[510,732,617],{"class":520},[510,734,735,738],{"class":512,"line":540},[510,736,737],{"class":613},"  \"scripts\"",[510,739,740],{"class":520},": {\n",[510,742,743,746,748,751],{"class":512,"line":575},[510,744,745],{"class":613},"    \"dev\"",[510,747,629],{"class":520},[510,749,750],{"class":527},"\"nitro dev\"",[510,752,617],{"class":520},[510,754,755,758,760],{"class":512,"line":607},[510,756,757],{"class":613},"    \"build\"",[510,759,629],{"class":520},[510,761,762],{"class":527},"\"nitro build\"\n",[510,764,765],{"class":512,"line":620},[510,766,767],{"class":520},"  },\n",[510,769,770,773],{"class":512,"line":638},[510,771,772],{"class":613},"  \"devDependencies\"",[510,774,740],{"class":520},[510,776,777,780,782],{"class":512,"line":644},[510,778,779],{"class":613},"    \"nitro\"",[510,781,629],{"class":520},[510,783,784],{"class":527},"\"latest\"\n",[510,786,788],{"class":512,"line":787},9,[510,789,790],{"class":520},"  }\n",[510,792,794],{"class":512,"line":793},10,[510,795,796],{"class":520},"}\n",[501,798,801],{"className":503,"code":799,"filename":800,"language":505,"meta":5,"style":5},"import { defineHandler, HTTPError } from \"nitro\";\n\nexport default defineHandler(() => {\n  throw new HTTPError(\"Example Error!\", { status: 500 });\n});\n","server.ts",[507,802,803,816,820,836,859],{"__ignoreMap":5},[510,804,805,807,810,812,814],{"class":512,"line":513},[510,806,517],{"class":516},[510,808,809],{"class":520}," { defineHandler, HTTPError } ",[510,811,524],{"class":516},[510,813,528],{"class":527},[510,815,531],{"class":520},[510,817,818],{"class":512,"line":534},[510,819,537],{"emptyLinePlaceholder":393},[510,821,822,824,826,829,832,834],{"class":512,"line":540},[510,823,543],{"class":516},[510,825,546],{"class":516},[510,827,828],{"class":549}," defineHandler",[510,830,831],{"class":520},"(() ",[510,833,569],{"class":516},[510,835,572],{"class":520},[510,837,838,841,843,846,848,851,854,856],{"class":512,"line":575},[510,839,840],{"class":516},"  throw",[510,842,581],{"class":516},[510,844,845],{"class":549}," HTTPError",[510,847,587],{"class":520},[510,849,850],{"class":527},"\"Example Error!\"",[510,852,853],{"class":520},", { status: ",[510,855,614],{"class":613},[510,857,858],{"class":520}," });\n",[510,860,861],{"class":512,"line":607},[510,862,647],{"class":520},[501,864,867],{"className":710,"code":865,"filename":866,"language":713,"meta":5,"style":5},"{\n  \"extends\": \"nitro/tsconfig\"\n}\n","tsconfig.json",[507,868,869,873,883],{"__ignoreMap":5},[510,870,871],{"class":512,"line":513},[510,872,720],{"class":520},[510,874,875,878,880],{"class":512,"line":534},[510,876,877],{"class":613},"  \"extends\"",[510,879,629],{"class":520},[510,881,882],{"class":527},"\"nitro/tsconfig\"\n",[510,884,885],{"class":512,"line":540},[510,886,796],{"class":520},[501,888,891],{"className":503,"code":889,"filename":890,"language":505,"meta":5,"style":5},"import { defineConfig } from \"vite\";\nimport { nitro } from \"nitro/vite\";\n\nexport default defineConfig({ plugins: [nitro()] });\n","vite.config.ts",[507,892,893,906,920,924],{"__ignoreMap":5},[510,894,895,897,899,901,904],{"class":512,"line":513},[510,896,517],{"class":516},[510,898,660],{"class":520},[510,900,524],{"class":516},[510,902,903],{"class":527}," \"vite\"",[510,905,531],{"class":520},[510,907,908,910,913,915,918],{"class":512,"line":534},[510,909,517],{"class":516},[510,911,912],{"class":520}," { nitro } ",[510,914,524],{"class":516},[510,916,917],{"class":527}," \"nitro/vite\"",[510,919,531],{"class":520},[510,921,922],{"class":512,"line":540},[510,923,537],{"emptyLinePlaceholder":393},[510,925,926,928,930,932,935,938],{"class":512,"line":575},[510,927,543],{"class":516},[510,929,546],{"class":516},[510,931,685],{"class":549},[510,933,934],{"class":520},"({ plugins: [",[510,936,937],{"class":549},"nitro",[510,939,940],{"class":520},"()] });\n",[942,943,944],"p",{},"This example shows how to intercept all errors and return a custom response format. When any route throws an error, Nitro calls your error handler instead of returning the default error page.",[946,947,949],"h2",{"id":948},"error-handler","Error Handler",[942,951,952,953,955],{},"Create an ",[507,954,499],{}," file in your project root to define the global error handler:",[501,957,958],{"className":503,"code":504,"filename":499,"language":505,"meta":5,"style":5},[507,959,960,972,976,998,1020,1028,1040,1044],{"__ignoreMap":5},[510,961,962,964,966,968,970],{"class":512,"line":513},[510,963,517],{"class":516},[510,965,521],{"class":520},[510,967,524],{"class":516},[510,969,528],{"class":527},[510,971,531],{"class":520},[510,973,974],{"class":512,"line":534},[510,975,537],{"emptyLinePlaceholder":393},[510,977,978,980,982,984,986,988,990,992,994,996],{"class":512,"line":540},[510,979,543],{"class":516},[510,981,546],{"class":516},[510,983,550],{"class":549},[510,985,553],{"class":520},[510,987,557],{"class":556},[510,989,560],{"class":520},[510,991,563],{"class":556},[510,993,566],{"class":520},[510,995,569],{"class":516},[510,997,572],{"class":520},[510,999,1000,1002,1004,1006,1008,1010,1012,1014,1016,1018],{"class":512,"line":575},[510,1001,578],{"class":516},[510,1003,581],{"class":516},[510,1005,584],{"class":549},[510,1007,587],{"class":520},[510,1009,590],{"class":527},[510,1011,557],{"class":520},[510,1013,595],{"class":527},[510,1015,598],{"class":520},[510,1017,601],{"class":527},[510,1019,604],{"class":520},[510,1021,1022,1024,1026],{"class":512,"line":607},[510,1023,610],{"class":520},[510,1025,614],{"class":613},[510,1027,617],{"class":520},[510,1029,1030,1032,1034,1036,1038],{"class":512,"line":620},[510,1031,623],{"class":520},[510,1033,626],{"class":527},[510,1035,629],{"class":520},[510,1037,632],{"class":527},[510,1039,635],{"class":520},[510,1041,1042],{"class":512,"line":638},[510,1043,641],{"class":520},[510,1045,1046],{"class":512,"line":644},[510,1047,647],{"class":520},[942,1049,1050],{},"The handler receives the thrown error and the H3 event object. You can use the event to access request details like headers, cookies, or the URL path to customize responses per route.",[946,1052,1054],{"id":1053},"triggering-an-error","Triggering an Error",[942,1056,1057],{},"The main handler throws an error to demonstrate the custom error handler:",[501,1059,1060],{"className":503,"code":799,"filename":800,"language":505,"meta":5,"style":5},[507,1061,1062,1074,1078,1092,1110],{"__ignoreMap":5},[510,1063,1064,1066,1068,1070,1072],{"class":512,"line":513},[510,1065,517],{"class":516},[510,1067,809],{"class":520},[510,1069,524],{"class":516},[510,1071,528],{"class":527},[510,1073,531],{"class":520},[510,1075,1076],{"class":512,"line":534},[510,1077,537],{"emptyLinePlaceholder":393},[510,1079,1080,1082,1084,1086,1088,1090],{"class":512,"line":540},[510,1081,543],{"class":516},[510,1083,546],{"class":516},[510,1085,828],{"class":549},[510,1087,831],{"class":520},[510,1089,569],{"class":516},[510,1091,572],{"class":520},[510,1093,1094,1096,1098,1100,1102,1104,1106,1108],{"class":512,"line":575},[510,1095,840],{"class":516},[510,1097,581],{"class":516},[510,1099,845],{"class":549},[510,1101,587],{"class":520},[510,1103,850],{"class":527},[510,1105,853],{"class":520},[510,1107,614],{"class":613},[510,1109,858],{"class":520},[510,1111,1112],{"class":512,"line":607},[510,1113,647],{"class":520},[942,1115,1116],{},"When you visit the page, instead of seeing a generic error page, you'll see \"Custom Error Handler: Example Error!\" because the error handler intercepts the thrown error.",[946,1118,1120],{"id":1119},"learn-more","Learn More",[1122,1123,1124],"ul",{},[1125,1126,1127],"li",{},[1128,1129,58],"a",{"href":59},[1131,1132,1133],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":5,"searchDepth":534,"depth":534,"links":1135},[1136,1137,1138],{"id":948,"depth":534,"text":949},{"id":1053,"depth":534,"text":1054},{"id":1119,"depth":534,"text":1120},"md",{"automd":393,"category":394,"icon":244},{"icon":244},{"title":241,"description":403},"3u_xbfsbNWoCLQCgubJSurDi6YZEEC6Ja0jz4x2woYg",[1145,1146],{"title":236,"path":237,"stem":238,"description":400,"icon":239,"children":-1},{"title":38,"path":246,"stem":247,"description":406,"icon":248,"children":-1},1775141595646]