title: How to handle failure of Realm instance creation?
body: <p>I am trying to setup a global realm object as shown below:</p>
  
  <pre><code>do {
        self.realm = try Realm(configuration: baseConfig) 
      } catch {
          fatalError("Error occurred while trying to initialise realm \(error)")
      } 
  </code></pre>
  
  <p>However, the fatalError is being called every so often. According to the Realm documentation this is not unexpected and I should be able to handle the error in the catch. </p>
  
  <blockquote>
    <p>Like any disk I/O operation, creating a Realm instance could sometimes fail if resources are constrained. In practice, this can only happen the first time a Realm instance is created on a given thread.</p>
  </blockquote>
  
  <p>I'm thinking of impelementing something like this where I just retry a second time.</p>
  
  <pre><code>do {
    self.realm = try Realm(configuration: baseConfig) 
  } catch {
     do {
        self.realm = try Realm(configuration: baseConfig) 
      } catch {
          fatalError("Error occurred while trying to initialise realm \(error)")
      } 
  } 
  </code></pre>
  
  <p>My question is if it is guaranteed that creating a Realm instance can only fail once on a thread, why doesn't Realm just retry itself? </p>
  
  <p>Is there a standard way of initializing the Realm object if it fails the first time?</p>