From e265b7b09034b2ce6b452a30e83a97be0cf7c9e4 Mon Sep 17 00:00:00 2001 From: Peter Lejeck Date: Wed, 29 Jun 2016 22:12:25 -0700 Subject: [PATCH] Log RecordInvalid when verbose_sso_logging enabled --- app/controllers/session_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rb index 98d59f386cf..a682f9727b2 100644 --- a/app/controllers/session_controller.rb +++ b/app/controllers/session_controller.rb @@ -126,6 +126,14 @@ class SessionController < ApplicationController render text: I18n.t("sso.not_found"), status: 500 end rescue ActiveRecord::RecordInvalid => e + if SiteSetting.verbose_sso_logging + Rails.logger.warn(<<-EOF) + Verbose SSO log: Record was invalid: #{e.record.class.name} #{e.record.id}\n + #{e.record.errors.to_h}\n + \n + #{sso.diagnostics} + EOF + end render text: I18n.t("sso.unknown_error"), status: 500 rescue => e message = "Failed to create or lookup user: #{e}."