Link Search Menu Expand Document

Debugging

You can debug errors in your script by returning the error in the response.

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
  try {
    // Your function code goes here.
    // If anything bad happens, it's caught below
  } catch (e) {
    // Any errors are returned here
    return new Response(e.stack || e.message, { status: 500 })
  }
}

© 2021 Bip.sh, Ltd.