Commit 2026abeb9a855e2e6e81cf1c9a7908ef0e98d1d5

Authored by Evandro Junior
1 parent 9b86fdd1

Captures exception and then logs it

Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
lib/noosfero/api/helpers.rb
... ... @@ -321,6 +321,7 @@
321 321 begin
322 322 body = https.request(request).body
323 323 rescue Exception => e
  324 + logger = Logger.new(File.join(Rails.root, 'log', "#{ENV['RAILS_ENV'] || 'production'}_api.log"))
324 325 logger.error e
325 326 return _("Google recaptcha error: #{e.message}")
326 327 end
... ... @@ -346,6 +347,7 @@
346 347 begin
347 348 body = https.request(request).body
348 349 rescue Exception => e
  350 + logger = Logger.new(File.join(Rails.root, 'log', "#{ENV['RAILS_ENV'] || 'production'}_api.log"))
349 351 logger.error e
350 352 return _("Google recaptcha error: #{e.message}")
351 353 end
... ... @@ -364,6 +366,7 @@
364 366 begin
365 367 body = http.request(request).body
366 368 rescue Exception => e
  369 + logger = Logger.new(File.join(Rails.root, 'log', "#{ENV['RAILS_ENV'] || 'production'}_api.log"))
367 370 logger.error e
368 371 return _("Serpro captcha error: #{e.message}")
369 372 end
... ...