Is this a good way to use Try catch? I'm new to handling errors and am not sure how to do it, basically, in a speicific request err.code === 11000 is not actually an error, but expected behaviour. I want to output it but not like another error and I want the code to continue running. I don't think it looks nice.

(async () =&gt;{
  let client;
  try {
    client = await MongoClient;
    let sales = await call(),
        collection = client.db("scraper").collection("sold");
        try {
          stored = await collection.insertMany(sales.sold, {ordered: false});
          console.log({completed: stored.result.n})
        }catch(err){
          if(err.code === 11000){log({completed: err.result.nInserted, duplicates: err.result.result.writeErrors.length})}
          else{log( {err} )}
        }
    //console.log(sales)
  } catch(err) {
    log(err)
  }
  client.close();
})()
In the case that the error code is not 11000 I would re-throw the error in the inner try. That way you do not repeat, possibly complex error logic or possibly execute code that you do not want to. i.e. instead of 

try {
  try {
    // code
  } catch(err) {
    if (err.code === 11000) { 
      log({completed: err.result.nInserted, duplicates: err.result.result.writeErrors.length})
    } else { 
      log('an error occurred', {err} )
    }
  }
  //code that shouldn't execute when an error occurs
} catch(err) {
  log('an error occurred', {err} )
}


something like

try {
  try {
    // code
  } catch(err1) {
    if (err1.code !== 11000) {
      throw err1;
    } 
    log({completed: err1.result.nInserted, duplicates: err1.result.result.writeErrors.length})
  }
  //code that shouldn't execute when an error occurs
} catch(err2) {
  log('an error occurred', {err2} )
}


I also suggest using different variable names in different exception handlers. Some spaces between parentheses and curly brackets would also make your code more readable.