diff --git a/index.js b/index.js index c1cdaec..09ecec8 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,17 @@ * @param {Request} request * @returns {Promise} */ - async function handleRequest(request) { +async function handleRequest(request) { + try { + const response = await handleRequestInternal(request); + return response; + } catch(err) { + console.error(err); + throw err; + } +} + +async function handleRequestInternal(request) { const { protocol, pathname } = new URL(request.url); // Require HTTPS (TLS) connection to be secure.