⇒ Find uncaught HTTP requests

JavaScript pattern

Find uncaught HTTP requests and wrap it with try {} catch{ }

Request without try catch block

BEFORE
await request('/bar');
AFTER
try { await request('/bar') } catch() {}

Request with try catch block

JAVASCRIPT
try {
  await request('/foo');
} catch {}

Request with async function

JAVASCRIPT
async function doRequest() {
  return request("/bar");
}

export function main() {
  try {
    await doRequest();
  } catch { }
}

Request without async function

BEFORE
function doRequest() {
  return request('/bar');
}
AFTER
function doRequest() {
  try {
    return request('/bar');
  } catch (err) {
    return err;
  }
}