title: How-to handle errors in Vim Script?
body: <p>In my <code>.vimrc</code> file, I have the following function, which folds the licensing information on the top of some <code>.hpp</code> and <code>.cpp</code> files:</p>
  <pre><code>&quot; Skip license 
  function! FoldLicense()
      if !exists(&quot;b:foldedLicense&quot;)
          let b:foldedLicense = 1
          1;/\*\//fold
      endif
  endfunction
  
  au BufRead *.hpp call FoldLicense()
  au BufRead *.cpp call FoldLicense()
  </code></pre>
  <p>This works well, but if I open a <code>.cpp</code> file which <strong>doesn't</strong> have any licensing information block, Vim complains that the pattern is <em>not found</em>. Fair enough, but is there a way so that he stops complaining and just <em>does nothing</em> if the pattern is not found ?</p>
  <p>Thanks !</p>
  <h3>Edit: complete solution (using Bryan Ross answer)</h3>
  <pre><code>&quot; Skip license 
  function! FoldLicense()
      if !exists(&quot;b:foldedLicense&quot;)
          let b:foldedLicense = 1
          silent! 1;/\*\//fold
      endif
  endfunction
  
  au BufRead *.hpp call FoldLicense()
  au BufRead *.cpp call FoldLicense()
  </code></pre>