Skip to content

Commit

Permalink
Wrap Exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlueder committed Aug 14, 2022
1 parent d52fee9 commit d6b7161
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
* @param {Request} request
* @returns {Promise<Response>}
*/
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.
Expand Down

0 comments on commit d6b7161

Please sign in to comment.