title: PHP chaining error handling
body: <p>Is a good idea throw exceptions on chained methods?</p>
  
  <p>For example:</p>
  
  <pre><code>class Mailer(){
  
      private $attachment;
  
      public function addAttachment($attachment){
          if($this-&gt;validateAttachment($attachment)){
              $this-&gt;attachment = $attachment;
          }
  
          throw new \InvalidArgumentException('Invalid attachment');
      }
  
      public function send(){
          [...]
      }
  
      private function validateAttachment($attachment){
          if($attachment === 'test'){
              return true;
          }
  
          return false;
      }
  }
  
  $mailer = new Mailer();
  $mailer-&gt;addAttachment('invalid')-&gt;send();
  </code></pre>
  
  <p>Of course, this will fail and cause a fatal error unless we use try / catch.</p>
  
  <p>Otherwise, if we don't thrown an error when <code>addAttachment</code> fails, use will not notice if anything went wrong. 
  And if the <code>send</code> can work without attachments, we cannot return an error on that method neither.</p>
  
  <p>So, there is any good practice on error logging / handling when using chained methods?</p>