In my Rails app I am making various API calls like this one:

```
class SearchFacebook

  FALLBACK_STARS = 5.0

  def self.call
    begin
      url = "https://graph.facebook.com/v2.12/#{FACEBOOK_PAGE_ID}"
      response = RestClient.get(url, :params => {:access_token => FACEBOOK_ACCESS_TOKEN, :fields => "overall_star_rating"})
      json = JSON.parse(response)
      stars = json["overall_star_rating"]
    rescue RestClient::ExceptionWithResponse => error
      stars = FALLBACK_STARS
    end
    {:stars => stars}
  end

end

```

The problem is that I am running my app in my local environment a lot of the time. When there's no Internet connection available (which happens a lot to me, don't ask why), I get the following error:

> 
> **SocketError**. 
>  Failed to open TCP connection to api.facebook.com:443 (getaddrinfo:
>  nodename nor servname provided, or not known)
> 
> 
> 

How can I rescue from *being offline*?

I checked [RestClient documentation](https://www.rubydoc.info/gems/rest-client/1.6.1/RestClient/Exception) already but to no avail. Thanks for any help.