title: Need to rescue 401 status code using RestClient
body: <p>I am using a Rails gem to send requests to an api using RestClient. I need to rescue a 401 error code. I saw the following on RestClient documentation:</p>
  
  <pre><code>&gt; RestClient.get('http://my-rest-service.com/resource'){ |response,
  &gt; request, result, &amp;block|   case response.code   when 200
  &gt;     p "It worked !"
  &gt;     response   when 423
  &gt;     raise SomeCustomExceptionIfYouWant   else
  &gt;     response.return!(request, result, &amp;block)   end }
  </code></pre>
  
  <p>I have attempted to implement a similar case statement:</p>
  
  <pre><code>case response.code
   when 200
    JSON.parse(response.body)
   when 401
    raise AuthenicationError, "Unauthorized"
   else
    raise RestClient::ExceptionWithResponse
  end
  </code></pre>
  
  <p>It captures the 200 case fine but ignores the 401 case and goes straight to the else. Any suggestions on raising an exception for 401 on a response that's coming back through RestClient?</p>