iron-io / issues

For Iron.io services issue tracking. Public facing issue tracking for behind the scenes issues.
5 stars 0 forks source link

Iron_Cache (Iron_Core, 1.0.2 update): Error when retrieving object for key that doesn't exist #89

Closed eappleby closed 10 years ago

eappleby commented 10 years ago

I created simple test script that reproduces error:

Here is error message: /app/vendor/bundle/ruby/1.9.1/gems/iron_core-1.0.2/lib/iron_core/client.rb:195:in extract_error_msg', undefined methodmsg=' for #Rest::Wrappers::RestClientExceptionWrapper:0x000000030ad040

Gemfile source 'https://rubygems.org' ruby '1.9.3' gem 'sinatra', '1.1.0' gem 'iron_core', '1.0.2' gem 'iron_cache, '1.4.0'

Test Script

require 'sinatra'
require 'json'
require 'iron_cache'

begin
    ironcache = IronCache::Client.new
    cache = ironcache.cache("test")
rescue => e
    cache = nil
    $stderr.puts "1. #{e.backtrace[0]}, #{e.message}"
end

get "/test" do 
    cache_key = "test"
    cache_result = nil

    begin
        if not cache.nil?
            cache_result = cache.get(cache_key)
            if not cache_result.nil?
                cache_result.value.to_s
            else
                val = "123"
                cache.put(cache_key, val.to_json, {:expires_in => 5})
                "not found"
            end
        end
    rescue => e
        $stderr.puts "2. #{cache_key}: #{e.backtrace[0]}, #{e.message}"
        "error"
    end
end
treeder commented 10 years ago

I think I know this one, checking it now.

treeder commented 10 years ago

Please update your rest gem to 2.6.5, fixes the bug. Sorry about that.