unjs / h3

⚡️ Minimal H(TTP) framework built for high performance and portability

Home Page:https://h3.unjs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-graceful error when proxy is offline

manniL opened this issue · comments

Environment

  • Operating System: Darwin
  • Node Version: v21.6.2
  • Nuxt Version: -
  • CLI Version: 3.11.1
  • Nitro Version: -
  • Package Manager: pnpm@8.5.0
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

  1. Use the h3 playground example
  2. Create a handler with the following code (StackBlitz won't work as it is about proxy):
eventHandler((event) => {
  let url = "http://some-non-existent.url.domain"
  return proxyRequest(event, url)
})
  1. Visit the route

Describe the bug

H3 responds with a 500 because the fetch request fails, either because the address can't be found or if the server is offline.

A more graceful way of handling would be nice 🤔

Additional context

No response

Logs

No response