Merge pull request #2887 from tchak/fix-old-carto
Fix sentry errors in old carto module
This commit is contained in:
commit
744117537b
2 changed files with 8 additions and 4 deletions
|
@ -65,9 +65,13 @@ class Users::CarteController < UsersController
|
||||||
# https://tools.ietf.org/html/rfc7946#section-3.1.6
|
# https://tools.ietf.org/html/rfc7946#section-3.1.6
|
||||||
if json_latlngs.present?
|
if json_latlngs.present?
|
||||||
multipolygone = JSON.parse(json_latlngs)
|
multipolygone = JSON.parse(json_latlngs)
|
||||||
multipolygone.reject! { |polygone| polygone.count < 4 }
|
if multipolygone.first == ["error", "TooManyPolygons"]
|
||||||
if multipolygone.present?
|
[].to_json
|
||||||
multipolygone.to_json
|
else
|
||||||
|
multipolygone.reject! { |polygone| polygone.count < 4 }
|
||||||
|
if multipolygone.present?
|
||||||
|
multipolygone.to_json
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,7 +91,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_safe_json(json)
|
def ensure_safe_json(json)
|
||||||
JSON.parse(json).to_json
|
json.present? ? JSON.parse(json).to_json : '[]'
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
Raven.capture_exception(e)
|
Raven.capture_exception(e)
|
||||||
{}
|
{}
|
||||||
|
|
Loading…
Reference in a new issue