Skip to content

Commit

Permalink
Rescue everything
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Sep 3, 2024
1 parent a0b346e commit 6690cca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class API < Grape::API
begin
vendor = Vendor.find_by(name: /\A#{params[:name].tr('_', '.')}\z/i)
present vendor
rescue Mongoid::Errors::DocumentNotFound
rescue Exception
error! 'Vendor not found', 404
end
end
Expand All @@ -51,7 +51,7 @@ class API < Grape::API
begin
dc = Datacenter.find_by(region: infra['region'], country: infra['country'])
markers << { latLng: dc.coordinates, name: dc.to_s }
rescue Mongoid::Errors::DocumentNotFound
rescue Exception
coord = Geocoder.coordinates("#{infra['region']}, #{infra['country']}")
markers << { latLng: coord, name: infra['region'] }
end
Expand Down

0 comments on commit 6690cca

Please sign in to comment.