We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72f02f2 commit f7c40e9Copy full SHA for f7c40e9
lib/esdb/resource.rb
@@ -1,6 +1,6 @@
1
module ESDB
2
class Resource < RestClient::Resource
3
- attr_accessor :params
+ attr_accessor :params, :response
4
5
def initialize(url=nil, options={}, *args)
6
options[:headers] ||= {}
@@ -47,14 +47,15 @@ def self.find(id)
47
resource = self.new(id: id)
48
resource.get!
49
50
- if [200..207].include?(resource.response.code)
+ if (200..207).include?(resource.response.code)
51
return resource
52
else
53
return nil
54
end
55
56
- rescue
57
- raise ESDB::Exception
+ rescue => e
+ raise ESDB::Exception if e.response && e.response.code != 404
58
+ nil
59
60
61
# A kind of find_or_create - experimental.
0 commit comments