title: Parsing a String to Option[LocalDateTime]
body: <p>I wrote a <code>TimeFormatter</code> to parse a <code>String</code> to an <code>Option[LocalDateTime]</code>. </p>
  
  <p>The API notes that either exception could be thrown.</p>
  
  <pre><code> private def convertToDateTime(date: String): Option[LocalDateTime] =
     try {
       Some( timeFormatter.parseLocalDateTime(date) )
     }
     catch { // DateTimeFormatter#parseLocalDateTime API throws these possible exceptions
       case e @ (_: IllegalArgumentException | _: UnsupportedOperationException) =&gt;
         log.error(s"Could not convert $date to LocalDateTime", e); None
  
     }
  </code></pre>
  
  <p><a href="http://en.wikipedia.org/wiki/Joshua_Bloch" rel="nofollow">Joshua Bloch</a> notes:</p>
  
  <blockquote>
    <p>Item 39: Use exceptions only for exceptional conditions.</p>
  </blockquote>
  
  <p>I thought of using a regular expression to catch an error. But, I'm not sure if my reg-ex will always match <code>jodatime</code>'s way of parsing the <code>String</code> to a <code>LocalDateTime</code>. I can trust that the API will throw those exceptions, but I'd rather not rely upon internals of the method call with a reg-ex.</p>
  
  <p>From a functional point of view, I'd rather not use exceptions.</p>
  
  <p>How can I write this function without exceptions?</p>