title: Ocaml exception handling for opening input channel
body: <p>As a beginner in Ocaml, I have this current working code:</p>
  
  <pre><code>...
  let ch_in = open_in input_file in
  try
      proc_lines ch_in
  with End_of_file -&gt; close_in ch_in;;
  </code></pre>
  
  <p>Now I would like to add error handling for non-existing input files, I wrote this:</p>
  
  <pre><code>let ch_in = try Some (open_in input_file) with _ -&gt; None in
  match ch_in with
  | Some x -&gt; try proc_lines x with End_of_file -&gt; close_in x
  | None -&gt; () ;;
  </code></pre>
  
  <p>and get an error message: <em>This pattern matches values of type 'a option
  but is here used to match values of type exn</em> for the last line. If I substitute <em>None</em> for <em>_</em>, I get an error about incomplete matching.</p>
  
  <p>I read that <em>exn</em> is the exception type. I'm sure I don't understand what is really going on here, so please point me to the right direction. Thanks!</p>