Skip to content

How to handle Net::ReadTimeout errors? #7

Description

@dsomel21

Basically, in my controller action where I am doing all my HTTP calls.

So currently, I have it set up as such:

def create_food
  # code that gets attributes from params...
  food.save
  
  if food.save
    begin 
       device = RubySpark::Device.new(unit.particle_id)
       response = device.function("httpGet","FOOD")
      # binding.pry 
     rescue RubySpark::Device::ApiError => e
        response = logger.error(e.message)
      end
    render :json => response
  end
end

Now, on the firmware side, the response looks perfect, but the pproblem is when I debug, and type out response, I am returned with the following.


Net::ReadTimeout: Net::ReadTimeout
from /home/dilraj/.rbenv/versions/2.1.1/lib/ruby/2.1.0/net/protocol.rb:158:in `rescue in rbuf_fill'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions