title: How to add catch() to async function that executes further code in nodejs
body: <p>I'm trying to pull values from a database and send slack messages (via <a href="https://slack.dev/node-slack-sdk/webhook" rel="nofollow noreferrer">https://slack.dev/node-slack-sdk/webhook</a>). If the slack webhook fails to resolve, I want it to post to a tool monitoring channel and want to use the built in Promise resolution for my coding logic. Please forgive me if I'm making a dumb mistake as I'm completely unfamiliar with nodejs/javascript</p>
  
  <p>I've tried appending catch() to the end but I really do not know where to start.</p>
  
  <pre><code>const IncomingWebhook = require('@slack/webhook').IncomingWebhook;
  var url = process.env.SLACK_WEBHOOK_URL;
  var webhook = new IncomingWebhook(url);
  const TOTAL_GHE_ISSUES = "10"
  const GHE_ISSUE_NUMBERS = "90"
  
  // Send the notification
  if (url != "")
  
      (async () =&gt; {
      await webhook.send({
          text: "*Daily Overdue Nessus Vulnerability Alert*",
          attachments: [{color: "#FF0000", blocks: [{type: "section",text: {type: "mrkdwn",text: "@here *" + TOTAL_GHE_ISSUES + "* Overdue Nessus Vulnerability issues reported \nOverdue Nessus Vulnerability GHE Issue Numbers: *" + GHE_ISSUE_NUMBERS + "*"}}]}]
      });
      })();
  
  
  
  else {console.log("No webhook provided");}
  </code></pre>
  
  <p>Before the else statement, I'd like to add a catch function if the webhook provided does not resolve that can then execute further code (in my case I want it to send a message to another slack channel with a static webhook). I'm looking for any help as I'm not sure where to start.</p>