lib/yao/resources/restfully_accessible.rb in yao-0.4.3 vs lib/yao/resources/restfully_accessible.rb in yao-0.5.0
- old
+ new
@@ -160,10 +160,11 @@
def get_by_name(name, query={})
# At first, search by ID. If nothing is found, search by name.
begin
GET(create_url([api_version, resources_path, name]), query)
- rescue Yao::ItemNotFound
+ rescue => e
+ raise e unless e.class == Yao::ItemNotFound || e.class == Yao::NotFound
item = find_by_name(name)
if item.size > 1
raise Yao::TooManyItemFonud.new("More than one resource exists with the name '#{name}'")
end
GET(create_url([api_version, resources_path, item.first.id]), query)