app/models/commit_status.rb
def octokit_error_as_status(type)
    yield
  rescue Octokit::ClientError => e
    Rails.logger.error(e) # log error for further debugging if it's not 404.
    {
      state: "missing",
      statuses: [{
        context: "Reference", # for releases/show.html.erb
        state: "missing",
        description: "Unable to get commit #{type}.",
        updated_at: Time.now # needed for #cache_duration
      }]
    }
  end
# don't blow up when github is down, but show a nice error
don't blow up when github is down, but show a nice error
don ' t blow up when github is down but show a nice error
def octokit_error_as_status(type)
    yield
  rescue Octokit::ClientError => e
    Rails.logger.error(e) 
    {
      state: "missing",
      statuses: [{
        context: "Reference", 
        state: "missing",
        description: "Unable to get commit #{type}.",
        updated_at: Time.now 
      }]
    }
  end
def octokit_error_as_status ( type ) yield rescue Octokit :: ClientError => e Rails . logger . error ( e ) { state : "missing" , statuses : [ { context : "Reference" , state : "missing" , description : "Unable to get commit #{type}." , updated_at : Time . now } ] } end
don't blow up when github is down, but show a nice error
don ' t blow up when github is down but show a nice error
# log error for further debugging if it's not 404. # for releases/show.html.erb # needed for #cache_duration
type