From 57927a37834b693bfb81ca70131d6437b113ff72 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Tue, 2 Apr 2024 15:41:36 +0200 Subject: [PATCH] chore: more log to address controller errors --- app/controllers/data_sources/adresse_controller.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/data_sources/adresse_controller.rb b/app/controllers/data_sources/adresse_controller.rb index 63fa62ff9..5ea9fa990 100644 --- a/app/controllers/data_sources/adresse_controller.rb +++ b/app/controllers/data_sources/adresse_controller.rb @@ -6,13 +6,16 @@ class DataSources::AdresseController < ApplicationController if response.success? results = JSON.parse(response.body, symbolize_names: true) - render json: format_results(results) - else - render json: [] + return render json: format_results(results) end - else - render json: [] end + + render json: [] + + rescue JSON::ParserError => e + Sentry.set_extras(body: response.body, code: response.code) + Sentry.capture_exception(e) + render json: [] end private