diff --git a/lib/external_credential/twitter.rb b/lib/external_credential/twitter.rb index 9adda00e0..d4f63dd9b 100644 --- a/lib/external_credential/twitter.rb +++ b/lib/external_credential/twitter.rb @@ -160,9 +160,9 @@ class ExternalCredential::Twitter rescue begin webhooks = client.webhooks - raise "Unable to get list of webooks. You use the wrong 'Dev environment label', only #{webhooks.inspect} available." - rescue => e - raise "Unable to get list of webooks. Maybe you do not have an Twitter developer approval right now or you use the wrong 'Dev environment label': #{e.message}" + raise "Dev Environment Label invalid. Please use an existing one #{webhooks[:environments].map { |e| e[:environment_name] }}, or create a new one." + rescue Twitter::Error => e + raise "#{e.message} Are you sure you created a development environment on developer.twitter.com?" end end webhook_id = nil diff --git a/spec/requests/external_credentials_spec.rb b/spec/requests/external_credentials_spec.rb index 1d6756995..cae98a3e7 100644 --- a/spec/requests/external_credentials_spec.rb +++ b/spec/requests/external_credentials_spec.rb @@ -248,7 +248,7 @@ RSpec.describe 'External Credentials', type: :request do include_examples 'for failure cases' do let(:status) { :ok } let(:error_message) { <<~ERR.chomp } - Unable to get list of webooks. Maybe you do not have an Twitter developer approval right now or you use the wrong 'Dev environment label': Forbidden. + Forbidden. Are you sure you created a development environment on developer.twitter.com? ERR end end @@ -260,7 +260,7 @@ RSpec.describe 'External Credentials', type: :request do include_examples 'for failure cases' do let(:status) { :ok } let(:error_message) { <<~ERR.chomp } - Unable to get list of webooks. Maybe you do not have an Twitter developer approval right now or you use the wrong 'Dev environment label': Unable to get list of webooks. You use the wrong 'Dev environment label', only {:environments=>[{:environment_name=>\"zammad\", :webhooks=>[]}]} available. + Dev Environment Label invalid. Please use an existing one ["zammad"], or create a new one. ERR end end