getting Thrown expression type does not confirm to Error type
<p>i am trying to implement some function to get Integer from somefunction using try catch in swift as</p>

<pre><code>//Enum 
enum LengthError: ErrorType {
    case NoInt
    case Default
}


  // get Max length From Key else throws error


     func getMaximumLength() throws -&gt; Int? {

            guard let length = Int(getStringForKey("KEY")) else {
                throw LengthError.NoInt
            }

            return length
        }

     // This function
        func getMaxLength() -&gt; Int {

            var maxLength: Int?
            do {
                maxLength =  try getMaximumLength()

            } catch LengthError.NoInt {

                maxLength = 20

            } catch LengthError.Default  {
                maxLength = 20

            } catch {
                 maxLength = 20
            }

            return  maxLength
        }
</code></pre>

<p>but compiler showing error at  getMaximumLength() func as "Thrown expression type 'String ' does not confirm to 'ErrorType'".</p>

<p>how to resolve this  issue?</p>