From f6247b6bf43c70221f032b2b63a5305e8287d487 Mon Sep 17 00:00:00 2001 From: Ilya Date: Tue, 26 Nov 2013 20:17:19 -0500 Subject: [PATCH] Improve error message when using wrong Crowdtilt API keys --- app/controllers/application_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a2fd74ac..4b985c76 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -62,7 +62,12 @@ def check_init rescue => exception @settings.update_attribute :initialized_flag, false sign_out current_user - redirect_to new_user_registration_url, :flash => { :error => "An error occurred, please contact team@crowdhoster.com: #{exception.message}" } + if(exception.message == "Invalid credentials" && Rails.env.development?) + errorMsg = 'Invalid credentials, check Crowdtilt API Key and API Secret' + else + errorMsg = exception.message + end + redirect_to new_user_registration_url, :flash => { :error => "An error occurred, please contact team@crowdhoster.com: #{errorMsg}" } return else @settings.update_attribute :ct_sandbox_guest_id, sandbox_guest['user']['id']