Permalink
Browse files

Use FailedRequest#not_found? instead of checking HTTP code.

  • Loading branch information...
1 parent 7fe5b94 commit a0643e721d33514c13b452737b455f00f0474a5c Kyle Kingsbury committed Apr 25, 2011
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/risky.rb
  2. +1 −1 lib/risky/indexes.rb
View
2 lib/risky.rb
@@ -26,7 +26,7 @@ def self.[](key, opts = {})
begin
new(key).reload(opts)
rescue Riak::FailedRequest => e
- raise unless e.code.to_i == 404
+ raise e unless e.not_found?
nil
end
end
View
2 lib/risky/indexes.rb
@@ -29,7 +29,7 @@ def self.by_#{attribute}(value)
).walk(:bucket => #{@bucket_name.inspect}).first.first
)
rescue Riak::FailedRequest => e
- raise e unless e.code.to_i == 404
+ raise e unless e.not_found?
nil
end
end

0 comments on commit a0643e7

Please sign in to comment.