title: How to handle mongoose connection error in try catch block?
body: <p>how to handle mongoose connection error in try catch block?. I want to use application db connection with async function. </p>
  
  <pre><code>class App {
    async dbconnect() {
      try {
        mongoose.connect("mongodb://127.0.0.2/test");
      } catch (error) {
        console.log(errror);
        process.exit(1);
      }
  
      if (mongoose.connection.readyState == 2) {
        console.log("Db Connected");
      }
    }
  }
  </code></pre>