title: While loop in R repeat with error
body: <p>I have a code like this :</p>
  
  <pre><code>iit = 0
  
  while(1)
  {
  SIGMABf=replicate(10, rnorm(10)) 
  iit=iit+1
  if(inherits(solve(SIGMABf), "error")){iit=iit-1;next}
  if (iit==10) {break}
  }
  </code></pre>
  
  <p>However the inherits function is not working for the inverse</p>
  
  <p>Is there a way to catch the error and repeat ?</p>