From 6690cca439dca059c61c80645805803cad054a8d Mon Sep 17 00:00:00 2001 From: Stefan Kolb Date: Tue, 3 Sep 2024 15:32:11 +0200 Subject: [PATCH] Rescue everything --- api.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api.rb b/api.rb index 5e3cb794..64198897 100644 --- a/api.rb +++ b/api.rb @@ -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 @@ -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