title: Throw exception when value is not found in enum instead of returning nil
body: <p>I have an array, decoded from a JSON sent by my server.
  I want, in one line of code, to retrieve the value of a node and transform it into a enum value.
  Several error can occur : (1) node does not exist, (2) node value is not a string (my enums have only String raw values), or (3) the string provided doesn't fit any existing value in the enum.</p>
  <p>For the moment, I made an extension of Dictionary that enable me to have (1) and (2) in one line for other things than enums, and propagate easily the error if it occurs :</p>
  <pre><code>struct MemberOptions : MyDecodable
  {
      var name:String 
      var age:Int 
      var facebookAccount:FacebookAccount
  
  
      init(from array:[String:Any]) throws 
      {
          // throw exception if node name doesn't exist, is json&lt;null&gt; or if it's value is not castable to the providen parameter (raw types or more complex object implementing MyDecodable protocol)
          name = try array.getSafe(&quot;name&quot;, String.self)
          age = try array.getSafe(&quot;age&quot;, Int.self) 
          facebookAccount = try array.getSafe(&quot;fb&quot;, FacebookAccount.self) 
  
      }
     
  }
  </code></pre>
  <p>Now comes the tricky part : I want (3) for enum, that is, propagate an error in one line if the provided string raw value is not a known enum value, for a given enum. I saw that the default init of an enum returns nil if the raw string value does not exist. I want it to throw an exception.</p>
  <p>Of course, I could make an init for all my enums that would throw an exception, but it's not generic, it would be a redundant code. Of course I could do also in my business classes inits :</p>
  <pre><code>if let enumVal = MyEnum(rawValue: try array.getSafe(&quot;enumKey&quot;, String.self))
  {
       self.enumVal = enumVal 
  } 
  else 
  {
      throw ValueNotPresentException()
  } 
  </code></pre>
  <p>but still it wouldn't be generic enough, I would have to do write these 4 lines for every enum I want to retrieve.</p>
  <p>What I'd like would be some shared function over all my enums something like <code>getSafely(raw: myRawString) throws</code> that would throw exception if raw value is not present, instead of returning nil. Then I could have (1) (2) and (3) in one line and not having to write redundant code :</p>
  <pre><code>enumProp = try EnumType.getSafely(fromRaw: try array.getSafely(&quot;key&quot;, String.self)) 
  </code></pre>
  <p>Is there any way to make such a generic system in Swift (using maybe enum protocols, or some reflection) ? How would you handle that ?</p>