From 7c19485c8f5bf78ae23db977196938d12b4ec388 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 22 Aug 2024 18:21:16 +0530 Subject: [PATCH] feat: return nil always --- lib/integrations/openai_base_service.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/integrations/openai_base_service.rb b/lib/integrations/openai_base_service.rb index 5a1bae2d0..1e8b42485 100644 --- a/lib/integrations/openai_base_service.rb +++ b/lib/integrations/openai_base_service.rb @@ -50,7 +50,10 @@ class Integrations::OpenaiBaseService JSON.parse(value, symbolize_names: true) rescue JSON::ParserError - value + # If json parse failed, returning the value as is will fail too + # since we access the keys as symbols down the line + # So it's best to return nil + nil end def save_to_cache(response)