title: If-statement: Best way to handle layering with same condition
body: <p>I'm pretty new to programming, but I've been trying to make sure I learn good design practices. My question is related to how to handle this sort of <code>if-statement</code> situation, as it seems to violate <code>Don't Repeat Yourself</code>.</p>
  
  <p>I have a class with a constructor that includes a method to connect to a database. The method will write to a <code>string</code> if there was an error in the connection code block. I then have a process method that analyzes metadata of the database, and will also write errors if any are found. I don't want the metadata analysis to run if there was already an error in the connection method, but is this the best way to do this?:</p>
  
  <pre><code>public bool Process()
  {
      if (ErrorLog == null)
      {
          //Metadata analysis code that may write errors
  
          if (ErrorLog == null)
              return true;
          else
              PublishErrorLog();
          return false;
      } 
      else
          PublishErrorLog();
      return false;
  }
  </code></pre>